aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-06-03 08:57:25 +0200
committerDavid Sterba <dsterba@suse.com>2022-07-25 17:45:34 +0200
commita4012f06f188b51a69a1f31f0fa10f37e671cebb (patch)
tree8a2a32253352a2d3137d7d899b22b7aacbf0502d /fs/btrfs/volumes.h
parentbtrfs: stop looking at btrfs_bio->iter in index_one_bio (diff)
downloadlinux-dev-a4012f06f188b51a69a1f31f0fa10f37e671cebb.tar.xz
linux-dev-a4012f06f188b51a69a1f31f0fa10f37e671cebb.zip
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>
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r--fs/btrfs/volumes.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index a3c3a0d716bd..588367c76c46 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -418,7 +418,12 @@ struct btrfs_io_stripe {
/* For the endio handler */
struct btrfs_io_context *bioc;
};
- u64 length; /* only used for discard mappings */
+};
+
+struct btrfs_discard_stripe {
+ struct btrfs_device *dev;
+ u64 physical;
+ u64 length;
};
/*
@@ -557,6 +562,9 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
int btrfs_map_sblock(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
u64 logical, u64 *length,
struct btrfs_io_context **bioc_ret);
+struct btrfs_discard_stripe *btrfs_map_discard(struct btrfs_fs_info *fs_info,
+ u64 logical, u64 *length_ret,
+ u32 *num_stripes);
int btrfs_get_io_geometry(struct btrfs_fs_info *fs_info, struct extent_map *map,
enum btrfs_map_op op, u64 logical,
struct btrfs_io_geometry *io_geom);