]> git.neil.brown.name Git - LaFS.git/commitdiff
Small lafs_refile clean up
authorNeilBrown <neilb@suse.de>
Wed, 15 Sep 2010 04:34:23 +0000 (14:34 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 15 Sep 2010 04:34:23 +0000 (14:34 +1000)
We don't need the 'onlru' variable any more.
And we shouldn't really delete data  blocks from the lru at that
point, as they could be on a cluster or io-pending list.
Index blocks are safe as their refcount is zero, so they can only
be on the leaf lru.

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

diff --git a/index.c b/index.c
index 74fc5337127a0f2225faf1bec8bd2280d6913a61..ec8fa9d8f816922a5f6469cafad83199cb53035f 100644 (file)
--- a/index.c
+++ b/index.c
@@ -887,7 +887,6 @@ void lafs_refile(struct block *b, int dec)
        while (b) {
                int ph;
                int free_me = 0;
-               int onlru = 0;
                struct inode *checkpin = NULL;
                struct inode *myi = NULL;
 
@@ -895,15 +894,6 @@ void lafs_refile(struct block *b, int dec)
 
                spin_lock(&lafs_hash_lock);
 
-               if (!list_empty(&b->lru) &&
-                   !test_bit(B_IOLock, &b->flags) &&
-                   !test_bit(B_Writeback, &b->flags) &&
-                   !test_bit(B_OnFree, &b->flags))
-                       /* If B_IOLock, then it might be on the cluster
-                        * list, but not the LRU.
-                        */
-                       onlru = 1;
-
                /* PinPending disappears with the last non-lru reference,
                 * (or possibly at other times).
                 */
@@ -929,7 +919,7 @@ void lafs_refile(struct block *b, int dec)
                        /* Don't need to be Pinned any more */
                        lafs_checkpoint_lock(fs);
                        if (test_and_clear_bit(B_Pinned, &b->flags)) {
-                               if (onlru) {
+                               if (test_bit(B_Index, &b->flags) && !list_empty_careful(&b->lru)) {
                                        spin_lock(&fs->lock);
                                        list_del_init(&b->lru);
                                        spin_unlock(&fs->lock);