]> git.neil.brown.name Git - LaFS.git/commitdiff
segments: swap then/else branches.
authorNeilBrown <neilb@suse.de>
Sat, 18 Sep 2010 12:24:36 +0000 (22:24 +1000)
committerNeilBrown <neilb@suse.de>
Sat, 18 Sep 2010 12:24:36 +0000 (22:24 +1000)
Swap 'then' and 'else' branches, inverting condition

Signed-off-by: NeilBrown <neilb@suse.de>
segments.c

index 5690add179309b08625775b32f85be6bca523945..f34799c46e19ea3a252f6cdcbd489391df725335 100644 (file)
@@ -1088,11 +1088,27 @@ again:
         * FIXME there should be a more general way to delay
         * updates to the Youth block.
         */
-       if (test_bit(FinalCheckpoint, &fs->fsstate) ||
-           (db &&
-            db->b.inode == fs->devs[*dev].segsum &&
-            db->b.fileaddr == ((*seg) >> (fs->blocksize_bits
-                                          - 1)))) {
+       if (!test_bit(FinalCheckpoint, &fs->fsstate) &&
+           !(db &&
+             db->b.inode == fs->devs[*dev].segsum &&
+             db->b.fileaddr == ((*seg) >> (fs->blocksize_bits
+                                           - 1)))) {
+               spin_unlock(&fs->lock);
+               if (db)
+                       putdref(db, MKREF(youth));
+
+               db = lafs_get_block(fs->devs[*dev].segsum,
+                                   (*seg) >> (fs->blocksize_bits
+                                              - 1),
+                                   NULL, GFP_KERNEL,
+                                   MKREF(youth));
+               /* As we hold a ref on youth block for anything in the
+                * table, and that block was loaded at the time, it must
+                * still be valid.
+                */
+               BUG_ON(!test_bit(B_Valid, &db->b.flags));
+               goto again;
+       } else {
                /* HACK youth_next should always be at least 0x8000 so that
                 * cleanable score differentiates well for new segments.
                 * old code would sometimes set youth_next very low, so
@@ -1163,22 +1179,6 @@ again:
                        *dev, *seg, fs->youth_next - 1);
                /* Note that we return an implicit reference to the ssum */
                return;
-       } else {
-               spin_unlock(&fs->lock);
-               if (db)
-                       putdref(db, MKREF(youth));
-
-               db = lafs_get_block(fs->devs[*dev].segsum,
-                                   (*seg) >> (fs->blocksize_bits
-                                              - 1),
-                                   NULL, GFP_KERNEL,
-                                   MKREF(youth));
-               /* As we hold a ref on youth block for anything in the
-                * table, and that block was loaded at the time, it must
-                * still be valid.
-                */
-               BUG_ON(!test_bit(B_Valid, &db->b.flags));
-               goto again;
        }
 }