Re: [RFC ONLY 4/8] btrfs: add boilerplate code to insert raid extent

Johannes Thumshirn
2022-05-17T08:05:10Z

On 17/05/2022 10:01, Qu Wenruo wrote:
>> @@ -6700,6 +6713,12 @@ static void btrfs_end_bio(struct bio *bio)
>> * go over the max number of errors
>> */
>> bio->bi_status = BLK_STS_OK;
>> +
>> + if (btrfs_op(bio) == BTRFS_MAP_WRITE &&
>> + btrfs_need_stripe_tree_update(bioc)) {
>> + btrfs_get_bioc(bioc);
>> + schedule_work(&bioc->stripe_update_work);
> Considering the stripe tree should be a 1:1 map for file extents, can't
> we do it in btrfs_finish_ordered_io()?

Unfortunately not at the moment. I need the stripes[] array from
btrfs_io_context to record the per-disk physical locations. Another
possibility would be to lift this array into btrfs_ordered_extent,
then it can be done in btrfs_finish_ordered_io().