]> git.neil.brown.name Git - LaFS.git/commitdiff
Remove pointless code duplication in refile.
authorNeilBrown <neilb@suse.de>
Sun, 18 Jul 2010 17:17:07 +0000 (19:17 +0200)
committerNeilBrown <neilb@suse.de>
Mon, 9 Aug 2010 01:58:09 +0000 (11:58 +1000)
Just get fs from inode once.

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

diff --git a/index.c b/index.c
index 517b3f23467287415ef85ae64c39f255e8a8bcfd..c20a06c5a2ef9a3237a260b70ccd8518cf0b22f5 100644 (file)
--- a/index.c
+++ b/index.c
@@ -857,6 +857,7 @@ void lafs_refile(struct block *b, int dec)
                        clear_bit(B_PinPending, &b->flags);
 
                ph = !!test_bit(B_Phase1, &b->flags);
+               fs = fs_from_inode(b->inode);
                /* See if we still need to be pinned */
                /* FIXME need some locking here ... */
                if (test_bit(B_Pinned, &b->flags) &&
@@ -872,7 +873,6 @@ void lafs_refile(struct block *b, int dec)
                      atomic_read(&iblk(b)->pincnt[1]) == 0))
                        ) {
                        /* Don't need to be Pinned any more */
-                       fs = fs_from_inode(b->inode);
                        lafs_checkpoint_lock(fs);
                        if (test_and_clear_bit(B_Pinned, &b->flags)) {
                                if (onlru) {
@@ -914,7 +914,6 @@ void lafs_refile(struct block *b, int dec)
                                list_del_init(&b->lru);
                                /* unlock */
                        }
-                       fs = fs_from_inode(b->inode);
                        spin_lock(&fs->lock);
                        if (list_empty(&b->lru)) {
                                if (test_bit(B_Realloc, &b->flags))
@@ -940,7 +939,6 @@ void lafs_refile(struct block *b, int dec)
                                      (1<<B_Dirty)))
                                ) {
                                int credits;
-                               fs = fs_from_inode(b->inode);
                                /* Don't need ->parent any more */
                                if (next_parent == NULL)
                                        next_parent = &b->parent->b;