diff mbox series

[02/11] btrfs: move mapping of block for discard to its caller

Message ID 32b32a9b68f956a3bfe216b72060001811a71d01.1582302545.git.dsterba@suse.com (mailing list archive)
State New, archived
Headers show
Series Minor cleanups | expand

Commit Message

David Sterba Feb. 21, 2020, 4:31 p.m. UTC
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.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/volumes.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Johannes Thumshirn Feb. 22, 2020, 8:40 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Anand Jain Feb. 24, 2020, 3:31 a.m. UTC | #2
On 2/22/20 12:31 AM, David Sterba wrote:
> 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.
> 
> Signed-off-by: David Sterba <dsterba@suse.com>

reviewed-by: Anand Jain <anand.jain@oracle.com>
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index d8a88866aaa3..997f2c70cb6c 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5953,10 +5953,7 @@  static int __btrfs_map_block(struct btrfs_fs_info *fs_info,
 	struct btrfs_io_geometry geom;
 
 	ASSERT(bbio_ret);
-
-	if (op == BTRFS_MAP_DISCARD)
-		return __btrfs_map_block_for_discard(fs_info, logical,
-						     length, bbio_ret);
+	ASSERT(op != BTRFS_MAP_DISCARD);
 
 	ret = btrfs_get_io_geometry(fs_info, op, logical, *length, &geom);
 	if (ret < 0)
@@ -6186,6 +6183,10 @@  int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
 		      u64 logical, u64 *length,
 		      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,
 				 mirror_num, 0);
 }