aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-06-06 10:50:35 -0400
committerJosef Bacik <josef@redhat.com>2011-06-08 16:37:29 -0400
commitf6a398298d34af66ec3a2d82a44a4dbc5277357d (patch)
tree5cb1a6437051c22f2f3ecca9a4c7d60e4192d377
parent723bda2083d44edbd6be0f0b09f902120dc07442 (diff)
Btrfs: fix duplicate checking logic
When merging my code into the integration test the second check for duplicate entries got screwed up. This patch fixes it by dropping ret2 and just using ret for the return value, and checking if we got an error before adding the bitmap to the local list. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
-rw-r--r--fs/btrfs/free-space-cache.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 8258ccf85dbd..38f3fd923043 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -250,7 +250,7 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
250 pgoff_t index = 0; 250 pgoff_t index = 0;
251 unsigned long first_page_offset; 251 unsigned long first_page_offset;
252 int num_checksums; 252 int num_checksums;
253 int ret = 0, ret2; 253 int ret = 0;
254 254
255 INIT_LIST_HEAD(&bitmaps); 255 INIT_LIST_HEAD(&bitmaps);
256 256
@@ -421,11 +421,10 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
421 goto free_cache; 421 goto free_cache;
422 } 422 }
423 spin_lock(&ctl->tree_lock); 423 spin_lock(&ctl->tree_lock);
424 ret2 = link_free_space(ctl, e); 424 ret = link_free_space(ctl, e);
425 ctl->total_bitmaps++; 425 ctl->total_bitmaps++;
426 ctl->op->recalc_thresholds(ctl); 426 ctl->op->recalc_thresholds(ctl);
427 spin_unlock(&ctl->tree_lock); 427 spin_unlock(&ctl->tree_lock);
428 list_add_tail(&e->list, &bitmaps);
429 if (ret) { 428 if (ret) {
430 printk(KERN_ERR "Duplicate entries in " 429 printk(KERN_ERR "Duplicate entries in "
431 "free space cache, dumping\n"); 430 "free space cache, dumping\n");
@@ -434,6 +433,7 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
434 page_cache_release(page); 433 page_cache_release(page);
435 goto free_cache; 434 goto free_cache;
436 } 435 }
436 list_add_tail(&e->list, &bitmaps);
437 } 437 }
438 438
439 num_entries--; 439 num_entries--;