Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "block: bio_copy_data_iter"

This reverts commit db1c7d77976775483a8ef240b4c705f113e13ea1.

We're reinstating the pktcdvd driver, which needs this API.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

+24 -15
+22 -15
block/bio.c
··· 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 ··· 1435 1414 struct bvec_iter src_iter = src->bi_iter; 1436 1415 struct bvec_iter dst_iter = dst->bi_iter; 1437 1416 1438 - while (src_iter.bi_size && dst_iter.bi_size) { 1439 - struct bio_vec src_bv = bio_iter_iovec(src, src_iter); 1440 - struct bio_vec dst_bv = bio_iter_iovec(dst, dst_iter); 1441 - unsigned int bytes = min(src_bv.bv_len, dst_bv.bv_len); 1442 - void *src_buf = bvec_kmap_local(&src_bv); 1443 - void *dst_buf = bvec_kmap_local(&dst_bv); 1444 - 1445 - memcpy(dst_buf, src_buf, bytes); 1446 - 1447 - kunmap_local(dst_buf); 1448 - kunmap_local(src_buf); 1449 - 1450 - bio_advance_iter_single(src, &src_iter, bytes); 1451 - bio_advance_iter_single(dst, &dst_iter, bytes); 1452 - } 1417 + bio_copy_data_iter(dst, &dst_iter, src, &src_iter); 1453 1418 } 1454 1419 EXPORT_SYMBOL(bio_copy_data); 1455 1420
+2
include/linux/bio.h
··· 475 475 extern void bio_set_pages_dirty(struct bio *bio); 476 476 extern void bio_check_pages_dirty(struct bio *bio); 477 477 478 + extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, 479 + struct bio *src, struct bvec_iter *src_iter); 478 480 extern void bio_copy_data(struct bio *dst, struct bio *src); 479 481 extern void bio_free_pages(struct bio *bio); 480 482 void guard_bio_eod(struct bio *bio);