From 787992e2fa83048d7c1dd6ede6a326a5fac18190 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 15 Sep 2010 14:34:23 +1000 Subject: [PATCH] Small lafs_refile clean up 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 --- index.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/index.c b/index.c index 74fc533..ec8fa9d 100644 --- 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); -- 2.39.5