]> git.neil.brown.name Git - LaFS.git/commitdiff
segment.c: allow the else branch to just fall-through
authorNeilBrown <neilb@suse.de>
Sat, 18 Sep 2010 12:25:42 +0000 (22:25 +1000)
committerNeilBrown <neilb@suse.de>
Sat, 18 Sep 2010 12:25:42 +0000 (22:25 +1000)
The 'then' branch does a goto, so we don't need the else.
This patch is mostly just re-indenting.

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

index f34799c46e19ea3a252f6cdcbd489391df725335..66d47eb9d26e1c8a21c6940148555941e364fa75 100644 (file)
@@ -1065,6 +1065,8 @@ void lafs_free_get(struct fs *fs, unsigned int *dev, u32 *seg,
        struct datablock *db = NULL;
        u16 *youthp;
        struct segstat *ss;
+       struct segsum *ssum;
+       int ssnum;
 
        BUG_ON(nonlogged); // FIXME should handle this case, not ignore it
 
@@ -1108,78 +1110,74 @@ again:
                 */
                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
-                * over-ride that
-                */
-               struct segsum *ssum;
-               int ssnum;
-               if (fs->youth_next < 0x8000)
-                       fs->youth_next = 0x8000;
+       }
+       /* 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
+        * over-ride that
+        */
+       if (fs->youth_next < 0x8000)
+               fs->youth_next = 0x8000;
 
-               if (db && test_bit(FinalCheckpoint, &fs->fsstate)) {
-                       putdref(db, MKREF(youth));
-                       db = NULL;
-               }
+       if (db && test_bit(FinalCheckpoint, &fs->fsstate)) {
+               putdref(db, MKREF(youth));
+               db = NULL;
+       }
 
-               if (db) {
-                       u16 y = fs->youth_next;
-                       if (fs->scan.do_decay &&
-                           (fs->scan.free_dev < ss->dev
-                            || (fs->scan.free_dev == ss->dev 
-                                && fs->scan.free_block < (ss->segment
-                                                          / (fs->blocksize / 2)))
-                                   ))
-                               /* Haven't decayed this block yet - revert decay */
-                               y = decay_undo(y);
-                       youthp = map_dblock(db);
-                       youthp[(*seg) & ((1 << (fs->blocksize_bits
-                                               - 1)) - 1)]
-                               = cpu_to_le16(y);
-                       unmap_dblock(db, youthp);
-               }
-               fs->youth_next++;
-
-               fs->segtrack->free.first = ss->next;
-               if (fs->segtrack->free.first == 0xFFFF)
-                       fs->segtrack->free.last = 0xFFFF;
-               fs->segtrack->free.cnt--;
-               ss->score = SCORE_ACTIVE;
-               /* still in table, but unlinked */
-               spin_unlock(&fs->lock);
+       if (db) {
+               u16 y = fs->youth_next;
+               if (fs->scan.do_decay &&
+                   (fs->scan.free_dev < ss->dev
+                    || (fs->scan.free_dev == ss->dev 
+                        && fs->scan.free_block < (ss->segment
+                                                  / (fs->blocksize / 2)))
+                           ))
+                       /* Haven't decayed this block yet - revert decay */
+                       y = decay_undo(y);
+               youthp = map_dblock(db);
+               youthp[(*seg) & ((1 << (fs->blocksize_bits
+                                       - 1)) - 1)]
+                       = cpu_to_le16(y);
+               unmap_dblock(db, youthp);
+       }
+       fs->youth_next++;
+
+       fs->segtrack->free.first = ss->next;
+       if (fs->segtrack->free.first == 0xFFFF)
+               fs->segtrack->free.last = 0xFFFF;
+       fs->segtrack->free.cnt--;
+       ss->score = SCORE_ACTIVE;
+       /* still in table, but unlinked */
+       spin_unlock(&fs->lock);
 
-               /* now need to reserve/dirty/reference the youth and
-                * segsum block for each snapshot that could possibly
-                * get written here.
-                * NOTE: this needs fixing to support snapshots. Later.
-                */
-               for (ssnum = 0; ssnum < 1 ; ssnum++) {
-                       ssum = segsum_find(fs, ss->segment, ss->dev, ssnum);
-                       if (IS_ERR(ss))
-                               /* ?? what do I need to release etc */
-                               /* Maybe this cannot fail because we own references
-                                * to the two blocks !! */
-                               LAFS_BUG(1, db ? &db->b : NULL);
-                       lafs_checkpoint_lock(fs);
-                       set_bit(B_PinPending, &ssum->ssblk->b.flags);
-                       (void)lafs_pin_dblock(ssum->ssblk, AccountSpace);
-                       if (ssnum == 0) {
-                               set_bit(B_PinPending, &ssum->youthblk->b.flags);
-                               (void)lafs_pin_dblock(ssum->youthblk, AccountSpace);
-                       }
-                       lafs_checkpoint_unlock(fs);
-               }
-               if (db) {
-                       lafs_dirty_dblock(db);
-                       putdref(db, MKREF(youth));
+       /* now need to reserve/dirty/reference the youth and
+        * segsum block for each snapshot that could possibly
+        * get written here.
+        * NOTE: this needs fixing to support snapshots. Later.
+        */
+       for (ssnum = 0; ssnum < 1 ; ssnum++) {
+               ssum = segsum_find(fs, ss->segment, ss->dev, ssnum);
+               if (IS_ERR(ss))
+                       /* ?? what do I need to release etc */
+                       /* Maybe this cannot fail because we own references
+                        * to the two blocks !! */
+                       LAFS_BUG(1, db ? &db->b : NULL);
+               lafs_checkpoint_lock(fs);
+               set_bit(B_PinPending, &ssum->ssblk->b.flags);
+               (void)lafs_pin_dblock(ssum->ssblk, AccountSpace);
+               if (ssnum == 0) {
+                       set_bit(B_PinPending, &ssum->youthblk->b.flags);
+                       (void)lafs_pin_dblock(ssum->youthblk, AccountSpace);
                }
-               dprintk("NEXT segment found %d/%d youth %d\n",
-                       *dev, *seg, fs->youth_next - 1);
-               /* Note that we return an implicit reference to the ssum */
-               return;
+               lafs_checkpoint_unlock(fs);
+       }
+       if (db) {
+               lafs_dirty_dblock(db);
+               putdref(db, MKREF(youth));
        }
+       dprintk("NEXT segment found %d/%d youth %d\n",
+               *dev, *seg, fs->youth_next - 1);
+       /* Note that we return an implicit reference to the ssum */
 }
 
 void lafs_seg_forget(struct fs *fs, int dev, u32 seg)