btrfs: split discard handling out of btrfs_map_block
authorChristoph Hellwig <hch@lst.de>
Fri, 3 Jun 2022 06:57:25 +0000 (08:57 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Jul 2022 15:45:34 +0000 (17:45 +0200)
commita4012f06f188b51a69a1f31f0fa10f37e671cebb
tree8a2a32253352a2d3137d7d899b22b7aacbf0502d
parent5eecef7108350f6506a55d8fd9508ea32caeecad
btrfs: split discard handling out of btrfs_map_block

Mapping block for discard doesn't really share any code with the regular
block mapping case.  Split it out into an entirely separate helper
that just returns an array of btrfs_discard_stripe structures and the
number of stripes.

This removes the need for the length field in the btrfs_io_context
structure, so remove tht.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h