]> git.neil.brown.name Git - LaFS.git/commitdiff
When cluster_allocate and EmptyIndex block, clear Dirty flags
authorNeilBrown <neilb@suse.de>
Wed, 23 Jun 2010 01:27:40 +0000 (11:27 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 23 Jun 2010 01:57:21 +0000 (11:57 +1000)
Because that is what cluster allocate is supposed to do...

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

index 2af96514b015b9ce1e1156d95add82676e0deb41..ea45fca34cb0707411f2ed19c0d20e97327da1f0 100644 (file)
--- 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 */