From: NeilBrown Date: Wed, 23 Jun 2010 01:27:40 +0000 (+1000) Subject: When cluster_allocate and EmptyIndex block, clear Dirty flags X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=4e38810d012b433db70173b03280ac99846acf3e;p=LaFS.git When cluster_allocate and EmptyIndex block, clear Dirty flags Because that is what cluster allocate is supposed to do... Signed-off-by: NeilBrown --- 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 */