aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2012-04-13 06:28:00 -0400
committerDavid Sterba <dsterba@suse.cz>2012-04-18 13:22:21 -0400
commitaefc1eb13ebbb86c5ffade8a9e2425cd71032d7e (patch)
tree36acddddf6f4b50877b22e683704bc2cbaf4d3b5
parent4735fb282830c0966b301dabcccf4753fa6604bb (diff)
Btrfs: don't call free_extent_buffer twice in iterate_irefs
Avoid calling free_extent_buffer more than once when the iterator function returns non-zero. The only code that uses this is scrub repair for corrupted nodatasum blocks. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
-rw-r--r--fs/btrfs/backref.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index b332ff04c5e..fb56bcc8037 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -1247,7 +1247,7 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root,
1247 struct btrfs_path *path, 1247 struct btrfs_path *path,
1248 iterate_irefs_t *iterate, void *ctx) 1248 iterate_irefs_t *iterate, void *ctx)
1249{ 1249{
1250 int ret; 1250 int ret = 0;
1251 int slot; 1251 int slot;
1252 u32 cur; 1252 u32 cur;
1253 u32 len; 1253 u32 len;
@@ -1259,7 +1259,7 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root,
1259 struct btrfs_inode_ref *iref; 1259 struct btrfs_inode_ref *iref;
1260 struct btrfs_key found_key; 1260 struct btrfs_key found_key;
1261 1261
1262 while (1) { 1262 while (!ret) {
1263 ret = inode_ref_info(inum, parent ? parent+1 : 0, fs_root, path, 1263 ret = inode_ref_info(inum, parent ? parent+1 : 0, fs_root, path,
1264 &found_key); 1264 &found_key);
1265 if (ret < 0) 1265 if (ret < 0)
@@ -1288,10 +1288,8 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root,
1288 (unsigned long long)found_key.objectid, 1288 (unsigned long long)found_key.objectid,
1289 (unsigned long long)fs_root->objectid); 1289 (unsigned long long)fs_root->objectid);
1290 ret = iterate(parent, iref, eb, ctx); 1290 ret = iterate(parent, iref, eb, ctx);
1291 if (ret) { 1291 if (ret)
1292 free_extent_buffer(eb);
1293 break; 1292 break;
1294 }
1295 len = sizeof(*iref) + name_len; 1293 len = sizeof(*iref) + name_len;
1296 iref = (struct btrfs_inode_ref *)((char *)iref + len); 1294 iref = (struct btrfs_inode_ref *)((char *)iref + len);
1297 } 1295 }