]> git.neil.brown.name Git - LaFS.git/commitdiff
Introduce DelayYouth
authorNeilBrown <neilb@suse.de>
Sat, 18 Sep 2010 13:00:48 +0000 (23:00 +1000)
committerNeilBrown <neilb@suse.de>
Sat, 18 Sep 2010 13:00:48 +0000 (23:00 +1000)
When writing out the accounting blocks we need to not update the youth
block if we happen to start a new segment.
We already do that at unmount time, so generalise it with a new flag.

Signed-Off-By: NeilBrown <neilb@suse.de>
checkpoint.c
roll.c
segments.c
state.h

index 47019380cb4acb5f9647b28b946a1a34333ffc9e..c031506043d0ca9f979e650986757b4672a60041 100644 (file)
@@ -488,6 +488,9 @@ static void flush_accounting(struct fs *fs)
 
 static void finish_checkpoint(struct fs *fs, int youth)
 {
+       /* Don't want to change the youth block while writing them out */
+       set_bit(DelayYouth, &fs->fsstate);
+
        flush_accounting(fs);
 
        /* if we are creating a snapshot, special handling is needed */
@@ -502,6 +505,8 @@ static void finish_checkpoint(struct fs *fs, int youth)
        dprintk("FinalFlush %d\n", fs->seq);
        lafs_cluster_flush(fs, 0);
 
+       clear_bit(DelayYouth, &fs->fsstate);
+
        if (!test_bit(FinalCheckpoint, &fs->fsstate))
                lafs_seg_apply_all(fs);
        lafs_clean_free(fs);
diff --git a/roll.c b/roll.c
index c75b1b42f6e470c9d00c5a7acade4bdbca21f1b9..e9a20fa02476d1e866fa74bebf220b410b13684f 100644 (file)
--- a/roll.c
+++ b/roll.c
@@ -484,6 +484,7 @@ static int roll_forward(struct fs *fs)
        fs->phase = 1;
        fs->qphase = 0;
        fs->checkpointing = CH_Checkpoint;
+       clear_bit(DelayYouth, &fs->fsstate);
 
        first = fs->checkpointcluster;
        err = roll_locate(fs, first, &next, &last, &seq, &max);
@@ -522,6 +523,7 @@ static int roll_forward(struct fs *fs)
                        if (fs->qphase == fs->phase &&
                            fs->checkpointing) {
                                fs->checkpointing = 0;
+                               clear_bit(DelayYouth, &fs->fsstate);
                                lafs_seg_apply_all(fs);
                        }
                }
index 847c144c852f4f3b3d0c47f06b5c90279896817f..12a6453f6e6007f45ccaf46cb5d41355ddd024b5 100644 (file)
@@ -1089,7 +1089,7 @@ again:
         * FIXME there should be a more general way to delay
         * updates to the Youth block.
         */
-       if (!test_bit(FinalCheckpoint, &fs->fsstate) &&
+       if (!test_bit(DelayYouth, &fs->fsstate) &&
            !(ssum &&
              ssum->devnum == ss->dev &&
              ssum->segnum == ss->segment)) {
@@ -1116,7 +1116,7 @@ again:
        if (fs->youth_next < 0x8000)
                fs->youth_next = 0x8000;
 
-       if (ssum && test_bit(FinalCheckpoint, &fs->fsstate)) {
+       if (ssum && test_bit(DelayYouth, &fs->fsstate)) {
                ss_put(ssum, fs);
                ssum = NULL;
        }
diff --git a/state.h b/state.h
index 0bc3cbacb02456b4c5c08460e93131745c9c3dcd..78f3debfcc72d4d5790c6380007b04bec128ac2b 100644 (file)
--- a/state.h
+++ b/state.h
@@ -122,6 +122,9 @@ struct fs {
 #define CheckpointOpen 11 /* Some data has been written since the last checkpoint,
                           * so 'next_checkpoint' is a valid timestamp
                           */
+#define DelayYouth 12  /* While set, don't update any youth blocks.  The update will
+                       * happen either during seg_apply_all or in roll-forward
+                       */
 
        unsigned long next_checkpoint; /* Valid when CheckpointOpen is set, holds
                                        * jiffie time by when we need to do a checkpoint