Commit df031f07 authored by Liu Bo's avatar Liu Bo Committed by Chris Mason

Btrfs: use helper for logical resolve

We already have a helper, iterate_inodes_from_logical(), for logical resolve,
so just use it.
Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
parent 69917e43
...@@ -3210,12 +3210,9 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root, ...@@ -3210,12 +3210,9 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root,
{ {
int ret = 0; int ret = 0;
int size; int size;
u64 extent_item_pos;
u64 flags = 0;
struct btrfs_ioctl_logical_ino_args *loi; struct btrfs_ioctl_logical_ino_args *loi;
struct btrfs_data_container *inodes = NULL; struct btrfs_data_container *inodes = NULL;
struct btrfs_path *path = NULL; struct btrfs_path *path = NULL;
struct btrfs_key key;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
...@@ -3241,23 +3238,13 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root, ...@@ -3241,23 +3238,13 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root,
goto out; goto out;
} }
ret = extent_from_logical(root->fs_info, loi->logical, path, &key, ret = iterate_inodes_from_logical(loi->logical, root->fs_info, path,
&flags); build_ino_list, inodes);
btrfs_release_path(path); if (ret == -EINVAL)
if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK)
ret = -ENOENT; ret = -ENOENT;
if (ret < 0) if (ret < 0)
goto out; goto out;
extent_item_pos = loi->logical - key.objectid;
ret = iterate_extent_inodes(root->fs_info, key.objectid,
extent_item_pos, 0, build_ino_list,
inodes);
if (ret < 0)
goto out;
ret = copy_to_user((void *)(unsigned long)loi->inodes, ret = copy_to_user((void *)(unsigned long)loi->inodes,
(void *)(unsigned long)inodes, size); (void *)(unsigned long)inodes, size);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment