Commit 75fb2e9e authored by David Sterba's avatar David Sterba

btrfs: move mapping of block for discard to its caller

There's a simple forwarded call based on the operation that would better
fit the caller btrfs_map_block that's until now a trivial wrapper.
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent ee787f95
...@@ -5878,10 +5878,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, ...@@ -5878,10 +5878,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info,
struct btrfs_io_geometry geom; struct btrfs_io_geometry geom;
ASSERT(bbio_ret); ASSERT(bbio_ret);
ASSERT(op != BTRFS_MAP_DISCARD);
if (op == BTRFS_MAP_DISCARD)
return __btrfs_map_block_for_discard(fs_info, logical,
length, bbio_ret);
ret = btrfs_get_io_geometry(fs_info, op, logical, *length, &geom); ret = btrfs_get_io_geometry(fs_info, op, logical, *length, &geom);
if (ret < 0) if (ret < 0)
...@@ -6111,6 +6108,10 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op, ...@@ -6111,6 +6108,10 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
u64 logical, u64 *length, u64 logical, u64 *length,
struct btrfs_bio **bbio_ret, int mirror_num) struct btrfs_bio **bbio_ret, int mirror_num)
{ {
if (op == BTRFS_MAP_DISCARD)
return __btrfs_map_block_for_discard(fs_info, logical,
length, bbio_ret);
return __btrfs_map_block(fs_info, op, logical, length, bbio_ret, return __btrfs_map_block(fs_info, op, logical, length, bbio_ret,
mirror_num, 0); mirror_num, 0);
} }
......
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