From 4e38810d012b433db70173b03280ac99846acf3e Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 23 Jun 2010 11:27:40 +1000 Subject: [PATCH] When cluster_allocate and EmptyIndex block, clear Dirty flags Because that is what cluster allocate is supposed to do... Signed-off-by: NeilBrown --- cluster.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cluster.c b/cluster.c index 2af9651..ea45fca 100644 --- a/cluster.c +++ b/cluster.c @@ -716,7 +716,20 @@ unsigned long long lafs_cluster_allocate(struct block *b, int cnum) lafs_iounlock_block(b); if (test_bit(B_EmptyIndex, &b->flags)) { + int credits = 0; lafs_allocated_block(fs, b, 0); + /* FIXME this is common code - make a function?? */ + if (cnum) { + if (test_and_clear_bit(B_Realloc, &b->flags)) + credits++; + LAFS_BUG(test_bit(B_Dirty, &b->flags), b); + } else { + if (test_and_clear_bit(B_Dirty, &b->flags)) + credits++; + if (test_and_clear_bit(B_Realloc, &b->flags)) + credits++; + } + lafs_space_return(fs, credits); lafs_writeback_done(b); mutex_unlock(&wc->lock); return wc->cluster_seq; /* FIXME is this really needed - or right */ -- 2.39.5