On Thu, Sep 14, 2023 at 09:06:58AM -0700, Johannes Thumshirn wrote:
Add support for inserting stripe extents into the raid stripe tree on
completion of every write that needs an extra logical-to-physical
translation when using RAID.
Inserting the stripe extents happens after the data I/O has completed,
this is done to a) support zone-append and b) rule out the possibility of
a RAID-write-hole.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
--- /dev/null
+++ b/fs/btrfs/raid-stripe-tree.c
+static int btrfs_insert_striped_mirrored_raid_extents(
+ struct btrfs_trans_handle *trans,
+ struct btrfs_ordered_extent *ordered,
+ u64 map_type)
+{
+ struct btrfs_io_context *bioc;
+ struct btrfs_io_context *rbioc;
+ const int nstripes = list_count_nodes(&ordered->bioc_list);
+ const int index = btrfs_bg_flags_to_raid_index(map_type);
+ const int substripes = btrfs_raid_array[index].sub_stripes;
+ const int max_stripes =
+ trans->fs_info->fs_devices->rw_devices / substripes;
This will probably warn due to u64/u32 division.