diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2012-09-07 22:01:29 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-10-01 15:19:18 -0400 |
commit | df031f0752d50f2061df2847d57ea52a79f7977c (patch) | |
tree | 85bf2ebee5a661cefb2752fa158b7e61571825b7 /fs/btrfs | |
parent | 69917e431210f8712fe050f47b7561e7dae89521 (diff) |
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: Liu Bo <bo.li.liu@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ioctl.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 48ff3f7317b0..fa1284d596ea 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -3210,12 +3210,9 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root, | |||
3210 | { | 3210 | { |
3211 | int ret = 0; | 3211 | int ret = 0; |
3212 | int size; | 3212 | int size; |
3213 | u64 extent_item_pos; | ||
3214 | u64 flags = 0; | ||
3215 | struct btrfs_ioctl_logical_ino_args *loi; | 3213 | struct btrfs_ioctl_logical_ino_args *loi; |
3216 | struct btrfs_data_container *inodes = NULL; | 3214 | struct btrfs_data_container *inodes = NULL; |
3217 | struct btrfs_path *path = NULL; | 3215 | struct btrfs_path *path = NULL; |
3218 | struct btrfs_key key; | ||
3219 | 3216 | ||
3220 | if (!capable(CAP_SYS_ADMIN)) | 3217 | if (!capable(CAP_SYS_ADMIN)) |
3221 | return -EPERM; | 3218 | return -EPERM; |
@@ -3241,23 +3238,13 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root, | |||
3241 | goto out; | 3238 | goto out; |
3242 | } | 3239 | } |
3243 | 3240 | ||
3244 | ret = extent_from_logical(root->fs_info, loi->logical, path, &key, | 3241 | ret = iterate_inodes_from_logical(loi->logical, root->fs_info, path, |
3245 | &flags); | 3242 | build_ino_list, inodes); |
3246 | btrfs_release_path(path); | 3243 | if (ret == -EINVAL) |
3247 | |||
3248 | if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) | ||
3249 | ret = -ENOENT; | 3244 | ret = -ENOENT; |
3250 | if (ret < 0) | 3245 | if (ret < 0) |
3251 | goto out; | 3246 | goto out; |
3252 | 3247 | ||
3253 | extent_item_pos = loi->logical - key.objectid; | ||
3254 | ret = iterate_extent_inodes(root->fs_info, key.objectid, | ||
3255 | extent_item_pos, 0, build_ino_list, | ||
3256 | inodes); | ||
3257 | |||
3258 | if (ret < 0) | ||
3259 | goto out; | ||
3260 | |||
3261 | ret = copy_to_user((void *)(unsigned long)loi->inodes, | 3248 | ret = copy_to_user((void *)(unsigned long)loi->inodes, |
3262 | (void *)(unsigned long)inodes, size); | 3249 | (void *)(unsigned long)inodes, size); |
3263 | if (ret) | 3250 | if (ret) |