@@ -1136,20 +1136,27 @@ static void validate_rbio_for_rmw(struct btrfs_raid_bio *rbio)
1136
1136
static void index_rbio_pages (struct btrfs_raid_bio * rbio )
1137
1137
{
1138
1138
struct bio * bio ;
1139
- struct bio_vec * bvec ;
1140
1139
u64 start ;
1141
1140
unsigned long stripe_offset ;
1142
1141
unsigned long page_index ;
1143
- int i ;
1144
1142
1145
1143
spin_lock_irq (& rbio -> bio_list_lock );
1146
1144
bio_list_for_each (bio , & rbio -> bio_list ) {
1145
+ struct bio_vec bvec ;
1146
+ struct bvec_iter iter ;
1147
+ int i = 0 ;
1148
+
1147
1149
start = (u64 )bio -> bi_iter .bi_sector << 9 ;
1148
1150
stripe_offset = start - rbio -> bbio -> raid_map [0 ];
1149
1151
page_index = stripe_offset >> PAGE_SHIFT ;
1150
1152
1151
- bio_for_each_segment_all (bvec , bio , i )
1152
- rbio -> bio_pages [page_index + i ] = bvec -> bv_page ;
1153
+ if (bio_flagged (bio , BIO_CLONED ))
1154
+ bio -> bi_iter = btrfs_io_bio (bio )-> iter ;
1155
+
1156
+ bio_for_each_segment (bvec , bio , iter ) {
1157
+ rbio -> bio_pages [page_index + i ] = bvec .bv_page ;
1158
+ i ++ ;
1159
+ }
1153
1160
}
1154
1161
spin_unlock_irq (& rbio -> bio_list_lock );
1155
1162
}
@@ -1423,11 +1430,14 @@ static int fail_bio_stripe(struct btrfs_raid_bio *rbio,
1423
1430
*/
1424
1431
static void set_bio_pages_uptodate (struct bio * bio )
1425
1432
{
1426
- struct bio_vec * bvec ;
1427
- int i ;
1433
+ struct bio_vec bvec ;
1434
+ struct bvec_iter iter ;
1435
+
1436
+ if (bio_flagged (bio , BIO_CLONED ))
1437
+ bio -> bi_iter = btrfs_io_bio (bio )-> iter ;
1428
1438
1429
- bio_for_each_segment_all (bvec , bio , i )
1430
- SetPageUptodate (bvec -> bv_page );
1439
+ bio_for_each_segment (bvec , bio , iter )
1440
+ SetPageUptodate (bvec . bv_page );
1431
1441
}
1432
1442
1433
1443
/*
0 commit comments