Skip to content

Commit aefc1eb

Browse files
Jan Schmidtkdave
authored andcommitted
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>
1 parent 4735fb2 commit aefc1eb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/btrfs/backref.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root,
12471247
struct btrfs_path *path,
12481248
iterate_irefs_t *iterate, void *ctx)
12491249
{
1250-
int ret;
1250+
int ret = 0;
12511251
int slot;
12521252
u32 cur;
12531253
u32 len;
@@ -1259,7 +1259,7 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root,
12591259
struct btrfs_inode_ref *iref;
12601260
struct btrfs_key found_key;
12611261

1262-
while (1) {
1262+
while (!ret) {
12631263
ret = inode_ref_info(inum, parent ? parent+1 : 0, fs_root, path,
12641264
&found_key);
12651265
if (ret < 0)
@@ -1288,10 +1288,8 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root,
12881288
(unsigned long long)found_key.objectid,
12891289
(unsigned long long)fs_root->objectid);
12901290
ret = iterate(parent, iref, eb, ctx);
1291-
if (ret) {
1292-
free_extent_buffer(eb);
1291+
if (ret)
12931292
break;
1294-
}
12951293
len = sizeof(*iref) + name_len;
12961294
iref = (struct btrfs_inode_ref *)((char *)iref + len);
12971295
}

0 commit comments

Comments
 (0)