@@ -6277,17 +6277,16 @@ static void handle_ops_on_dev_replace(enum btrfs_map_op op,
6277
6277
bioc -> replace_nr_stripes = nr_extra_stripes ;
6278
6278
}
6279
6279
6280
- static u64 btrfs_max_io_len (struct btrfs_chunk_map * map , enum btrfs_map_op op ,
6281
- u64 offset , u32 * stripe_nr , u64 * stripe_offset ,
6282
- u64 * full_stripe_start )
6280
+ static u64 btrfs_max_io_len (struct btrfs_chunk_map * map , u64 offset ,
6281
+ struct btrfs_io_geometry * io_geom )
6283
6282
{
6284
6283
/*
6285
6284
* Stripe_nr is the stripe where this block falls. stripe_offset is
6286
6285
* the offset of this block in its stripe.
6287
6286
*/
6288
- * stripe_offset = offset & BTRFS_STRIPE_LEN_MASK ;
6289
- * stripe_nr = offset >> BTRFS_STRIPE_LEN_SHIFT ;
6290
- ASSERT (* stripe_offset < U32_MAX );
6287
+ io_geom -> stripe_offset = offset & BTRFS_STRIPE_LEN_MASK ;
6288
+ io_geom -> stripe_nr = offset >> BTRFS_STRIPE_LEN_SHIFT ;
6289
+ ASSERT (io_geom -> stripe_offset < U32_MAX );
6291
6290
6292
6291
if (map -> type & BTRFS_BLOCK_GROUP_RAID56_MASK ) {
6293
6292
unsigned long full_stripe_len =
@@ -6302,26 +6301,25 @@ static u64 btrfs_max_io_len(struct btrfs_chunk_map *map, enum btrfs_map_op op,
6302
6301
* to go rounddown(), not round_down(), as nr_data_stripes is
6303
6302
* not ensured to be power of 2.
6304
6303
*/
6305
- * full_stripe_start =
6306
- btrfs_stripe_nr_to_offset (
6307
- rounddown (* stripe_nr , nr_data_stripes (map )));
6304
+ io_geom -> raid56_full_stripe_start = btrfs_stripe_nr_to_offset (
6305
+ rounddown (io_geom -> stripe_nr , nr_data_stripes (map )));
6308
6306
6309
- ASSERT (* full_stripe_start + full_stripe_len > offset );
6310
- ASSERT (* full_stripe_start <= offset );
6307
+ ASSERT (io_geom -> raid56_full_stripe_start + full_stripe_len > offset );
6308
+ ASSERT (io_geom -> raid56_full_stripe_start <= offset );
6311
6309
/*
6312
6310
* For writes to RAID56, allow to write a full stripe set, but
6313
6311
* no straddling of stripe sets.
6314
6312
*/
6315
- if (op == BTRFS_MAP_WRITE )
6316
- return full_stripe_len - (offset - * full_stripe_start );
6313
+ if (io_geom -> op == BTRFS_MAP_WRITE )
6314
+ return full_stripe_len - (offset - io_geom -> raid56_full_stripe_start );
6317
6315
}
6318
6316
6319
6317
/*
6320
6318
* For other RAID types and for RAID56 reads, allow a single stripe (on
6321
6319
* a single disk).
6322
6320
*/
6323
6321
if (map -> type & BTRFS_BLOCK_GROUP_STRIPE_MASK )
6324
- return BTRFS_STRIPE_LEN - * stripe_offset ;
6322
+ return BTRFS_STRIPE_LEN - io_geom -> stripe_offset ;
6325
6323
return U64_MAX ;
6326
6324
}
6327
6325
@@ -6564,9 +6562,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
6564
6562
6565
6563
map_offset = logical - map -> start ;
6566
6564
io_geom .raid56_full_stripe_start = (u64 )- 1 ;
6567
- max_len = btrfs_max_io_len (map , io_geom .op , map_offset , & io_geom .stripe_nr ,
6568
- & io_geom .stripe_offset ,
6569
- & io_geom .raid56_full_stripe_start );
6565
+ max_len = btrfs_max_io_len (map , map_offset , & io_geom );
6570
6566
* length = min_t (u64 , map -> chunk_len - map_offset , max_len );
6571
6567
6572
6568
down_read (& dev_replace -> rwsem );
0 commit comments