Re: [PATCH 01/10] btrfs: Always initialize btrfs_bio::tgtdev_map/raid_map pointers

Johannes Thumshirn
2020-07-02T14:04:30Z

On 02/07/2020 15:47, Nikolay Borisov wrote:
[...]
> - bbio->raid_map = (u64 *)((void *)bbio->stripes +
> - sizeof(struct btrfs_bio_stripe) *
> - num_alloc_stripes +
> - sizeof(int) * tgtdev_indexes);

That one took me a while to be convinced it is correct.

>
> /* Work out the disk rotation on this stripe-set */
> div_u64_rem(stripe_nr, num_stripes, &rot);
> @@ -6171,25 +6178,14 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info,
> if (map->type & BTRFS_BLOCK_GROUP_RAID6)
> bbio->raid_map[(i+rot+1) % num_stripes] =
> RAID6_Q_STRIPE;
> - }
> -
>
> - for (i = 0; i < num_stripes; i++) {
> - bbio->stripes[i].physical =
> - map->stripes[stripe_index].physical +
> - stripe_offset +
> - stripe_nr * map->stripe_len;
> - bbio->stripes[i].dev =
> - map->stripes[stripe_index].dev;
> - stripe_index++;
> + sort_parity_stripes(bbio, num_stripes);
> }
>
> +

Stray newline.