Commit ee4b4e22 authored by Jens Axboe's avatar Jens Axboe

Revert "block: bio_copy_data_iter"

This reverts commit db1c7d77.

We're reinstating the pktcdvd driver, which needs this API.
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent fa8e442e
...@@ -1401,6 +1401,27 @@ void __bio_advance(struct bio *bio, unsigned bytes) ...@@ -1401,6 +1401,27 @@ void __bio_advance(struct bio *bio, unsigned bytes)
} }
EXPORT_SYMBOL(__bio_advance); EXPORT_SYMBOL(__bio_advance);
void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter,
struct bio *src, struct bvec_iter *src_iter)
{
while (src_iter->bi_size && dst_iter->bi_size) {
struct bio_vec src_bv = bio_iter_iovec(src, *src_iter);
struct bio_vec dst_bv = bio_iter_iovec(dst, *dst_iter);
unsigned int bytes = min(src_bv.bv_len, dst_bv.bv_len);
void *src_buf = bvec_kmap_local(&src_bv);
void *dst_buf = bvec_kmap_local(&dst_bv);
memcpy(dst_buf, src_buf, bytes);
kunmap_local(dst_buf);
kunmap_local(src_buf);
bio_advance_iter_single(src, src_iter, bytes);
bio_advance_iter_single(dst, dst_iter, bytes);
}
}
EXPORT_SYMBOL(bio_copy_data_iter);
/** /**
* bio_copy_data - copy contents of data buffers from one bio to another * bio_copy_data - copy contents of data buffers from one bio to another
* @src: source bio * @src: source bio
...@@ -1414,21 +1435,7 @@ void bio_copy_data(struct bio *dst, struct bio *src) ...@@ -1414,21 +1435,7 @@ void bio_copy_data(struct bio *dst, struct bio *src)
struct bvec_iter src_iter = src->bi_iter; struct bvec_iter src_iter = src->bi_iter;
struct bvec_iter dst_iter = dst->bi_iter; struct bvec_iter dst_iter = dst->bi_iter;
while (src_iter.bi_size && dst_iter.bi_size) { bio_copy_data_iter(dst, &dst_iter, src, &src_iter);
struct bio_vec src_bv = bio_iter_iovec(src, src_iter);
struct bio_vec dst_bv = bio_iter_iovec(dst, dst_iter);
unsigned int bytes = min(src_bv.bv_len, dst_bv.bv_len);
void *src_buf = bvec_kmap_local(&src_bv);
void *dst_buf = bvec_kmap_local(&dst_bv);
memcpy(dst_buf, src_buf, bytes);
kunmap_local(dst_buf);
kunmap_local(src_buf);
bio_advance_iter_single(src, &src_iter, bytes);
bio_advance_iter_single(dst, &dst_iter, bytes);
}
} }
EXPORT_SYMBOL(bio_copy_data); EXPORT_SYMBOL(bio_copy_data);
......
...@@ -475,6 +475,8 @@ void __bio_release_pages(struct bio *bio, bool mark_dirty); ...@@ -475,6 +475,8 @@ void __bio_release_pages(struct bio *bio, bool mark_dirty);
extern void bio_set_pages_dirty(struct bio *bio); extern void bio_set_pages_dirty(struct bio *bio);
extern void bio_check_pages_dirty(struct bio *bio); extern void bio_check_pages_dirty(struct bio *bio);
extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter,
struct bio *src, struct bvec_iter *src_iter);
extern void bio_copy_data(struct bio *dst, struct bio *src); extern void bio_copy_data(struct bio *dst, struct bio *src);
extern void bio_free_pages(struct bio *bio); extern void bio_free_pages(struct bio *bio);
void guard_bio_eod(struct bio *bio); void guard_bio_eod(struct bio *bio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment