]> git.neil.brown.name Git - LaFS.git/commitdiff
space_alloc is being called badly.
authorNeilBrown <neilb@suse.de>
Tue, 22 Jun 2010 21:01:52 +0000 (07:01 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 23 Jun 2010 01:57:21 +0000 (11:57 +1000)
The is/then/else structure in both these cases is just wrong.

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

diff --git a/clean.c b/clean.c
index 103774f1036ca675a7bc7b2796e2584b84d3dbb7..39fccbaa43e49995c2ee8dd3828b4ae86499a159 100644 (file)
--- a/clean.c
+++ b/clean.c
@@ -155,11 +155,12 @@ static int mark_cleaning(struct block *b)
                return err;
        LAFS_BUG(!test_bit(B_Valid, &b->flags), b);
        if (!test_bit(B_Realloc, &b->flags)) {
-               if (lafs_space_alloc(fs_from_inode(b->inode), 1, CleanSpace) == 1)
+               if (lafs_space_alloc(fs_from_inode(b->inode), 1, CleanSpace) == 1) {
                        if (test_and_set_bit(B_Realloc, &b->flags))
                                lafs_space_return(fs_from_inode(b->inode), 1);
-       } else
-               return -EAGAIN;
+               } else
+                       return -EAGAIN;
+       }
        lafs_pin_block(b);
        if (test_bit(B_Dirty, &b->flags)) {
                /* If dirty, then now that it is pinned,
diff --git a/index.c b/index.c
index 49c2c789c333c1929dc44aeaa5e3c8c07addff07..1f2306b80f9b6e71e131d2995989ed9bb283a918 100644 (file)
--- a/index.c
+++ b/index.c
@@ -2115,9 +2115,8 @@ int lafs_allocated_block(struct fs *fs, struct block *blk, u64 phys)
                        if (lafs_space_alloc(fs, 1, CleanSpace) == 1) {
                                if (test_and_set_bit(B_Realloc, &p->b.flags))
                                        lafs_space_return(fs, 1);
-                               else
-                                       lafs_dirty_iblock(p);
-                       }
+                       } else
+                               lafs_dirty_iblock(p);
                }
                if (!test_and_set_bit(B_UnincCredit, &p->b.flags))
                        if (!test_and_clear_bit(B_ICredit, &p->b.flags))