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>
This commit is contained in:
committed by
David Sterba
parent
4735fb2828
commit
aefc1eb13e
@@ -1247,7 +1247,7 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root,
|
|||||||
struct btrfs_path *path,
|
struct btrfs_path *path,
|
||||||
iterate_irefs_t *iterate, void *ctx)
|
iterate_irefs_t *iterate, void *ctx)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = 0;
|
||||||
int slot;
|
int slot;
|
||||||
u32 cur;
|
u32 cur;
|
||||||
u32 len;
|
u32 len;
|
||||||
@@ -1259,7 +1259,7 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root,
|
|||||||
struct btrfs_inode_ref *iref;
|
struct btrfs_inode_ref *iref;
|
||||||
struct btrfs_key found_key;
|
struct btrfs_key found_key;
|
||||||
|
|
||||||
while (1) {
|
while (!ret) {
|
||||||
ret = inode_ref_info(inum, parent ? parent+1 : 0, fs_root, path,
|
ret = inode_ref_info(inum, parent ? parent+1 : 0, fs_root, path,
|
||||||
&found_key);
|
&found_key);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@@ -1288,10 +1288,8 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root,
|
|||||||
(unsigned long long)found_key.objectid,
|
(unsigned long long)found_key.objectid,
|
||||||
(unsigned long long)fs_root->objectid);
|
(unsigned long long)fs_root->objectid);
|
||||||
ret = iterate(parent, iref, eb, ctx);
|
ret = iterate(parent, iref, eb, ctx);
|
||||||
if (ret) {
|
if (ret)
|
||||||
free_extent_buffer(eb);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
len = sizeof(*iref) + name_len;
|
len = sizeof(*iref) + name_len;
|
||||||
iref = (struct btrfs_inode_ref *)((char *)iref + len);
|
iref = (struct btrfs_inode_ref *)((char *)iref + len);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user