@@ -1401,6 +1401,27 @@ void __bio_advance(struct bio *bio, unsigned bytes)
1401
1401
}
1402
1402
EXPORT_SYMBOL (__bio_advance );
1403
1403
1404
+ void bio_copy_data_iter (struct bio * dst , struct bvec_iter * dst_iter ,
1405
+ struct bio * src , struct bvec_iter * src_iter )
1406
+ {
1407
+ while (src_iter -> bi_size && dst_iter -> bi_size ) {
1408
+ struct bio_vec src_bv = bio_iter_iovec (src , * src_iter );
1409
+ struct bio_vec dst_bv = bio_iter_iovec (dst , * dst_iter );
1410
+ unsigned int bytes = min (src_bv .bv_len , dst_bv .bv_len );
1411
+ void * src_buf = bvec_kmap_local (& src_bv );
1412
+ void * dst_buf = bvec_kmap_local (& dst_bv );
1413
+
1414
+ memcpy (dst_buf , src_buf , bytes );
1415
+
1416
+ kunmap_local (dst_buf );
1417
+ kunmap_local (src_buf );
1418
+
1419
+ bio_advance_iter_single (src , src_iter , bytes );
1420
+ bio_advance_iter_single (dst , dst_iter , bytes );
1421
+ }
1422
+ }
1423
+ EXPORT_SYMBOL (bio_copy_data_iter );
1424
+
1404
1425
/**
1405
1426
* bio_copy_data - copy contents of data buffers from one bio to another
1406
1427
* @src: source bio
@@ -1414,21 +1435,7 @@ void bio_copy_data(struct bio *dst, struct bio *src)
1414
1435
struct bvec_iter src_iter = src -> bi_iter ;
1415
1436
struct bvec_iter dst_iter = dst -> bi_iter ;
1416
1437
1417
- while (src_iter .bi_size && dst_iter .bi_size ) {
1418
- struct bio_vec src_bv = bio_iter_iovec (src , src_iter );
1419
- struct bio_vec dst_bv = bio_iter_iovec (dst , dst_iter );
1420
- unsigned int bytes = min (src_bv .bv_len , dst_bv .bv_len );
1421
- void * src_buf = bvec_kmap_local (& src_bv );
1422
- void * dst_buf = bvec_kmap_local (& dst_bv );
1423
-
1424
- memcpy (dst_buf , src_buf , bytes );
1425
-
1426
- kunmap_local (dst_buf );
1427
- kunmap_local (src_buf );
1428
-
1429
- bio_advance_iter_single (src , & src_iter , bytes );
1430
- bio_advance_iter_single (dst , & dst_iter , bytes );
1431
- }
1438
+ bio_copy_data_iter (dst , & dst_iter , src , & src_iter );
1432
1439
}
1433
1440
EXPORT_SYMBOL (bio_copy_data );
1434
1441
0 commit comments