diff options
author | Johannes Thumshirn <johannes.thumshirn@wdc.com> | 2023-09-14 19:07:00 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-10-12 17:44:09 +0300 |
commit | 10e27980f2ff66ba0c6da55f33b4814d5bc86573 (patch) | |
tree | 46a4abbfc3d176b5bc0af68ebdc482c4d4b66dbe /fs/btrfs/raid-stripe-tree.h | |
parent | ca41504efda646d9c4b00c37be52f5ba07cebebf (diff) | |
download | linux-10e27980f2ff66ba0c6da55f33b4814d5bc86573.tar.xz |
btrfs: lookup physical address from stripe extent
Lookup the physical address from the raid stripe tree when a read on an
RAID volume formatted with the raid stripe tree was attempted.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/raid-stripe-tree.h')
-rw-r--r-- | fs/btrfs/raid-stripe-tree.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/raid-stripe-tree.h b/fs/btrfs/raid-stripe-tree.h index 9476131a6497..f0f3c99b8a6f 100644 --- a/fs/btrfs/raid-stripe-tree.h +++ b/fs/btrfs/raid-stripe-tree.h @@ -12,6 +12,9 @@ struct btrfs_ordered_extent; struct btrfs_trans_handle; int btrfs_delete_raid_extent(struct btrfs_trans_handle *trans, u64 start, u64 length); +int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info, + u64 logical, u64 *length, u64 map_type, + u32 stripe_index, struct btrfs_io_stripe *stripe); int btrfs_insert_raid_extent(struct btrfs_trans_handle *trans, struct btrfs_ordered_extent *ordered_extent); @@ -33,4 +36,10 @@ static inline bool btrfs_need_stripe_tree_update(struct btrfs_fs_info *fs_info, return false; } +static inline int btrfs_num_raid_stripes(u32 item_size) +{ + return (item_size - offsetof(struct btrfs_stripe_extent, strides)) / + sizeof(struct btrfs_raid_stride); +} + #endif |