Commit f434cdc7 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: use memcpy_to_bvec in copy_to_high_bio_irq

Use memcpy_to_bvec instead of opencoding the logic.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20210727055646.118787-12-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f8b679a0
...@@ -67,18 +67,6 @@ static __init int init_emergency_pool(void) ...@@ -67,18 +67,6 @@ static __init int init_emergency_pool(void)
__initcall(init_emergency_pool); __initcall(init_emergency_pool);
/*
* highmem version, map in to vec
*/
static void bounce_copy_vec(struct bio_vec *to, unsigned char *vfrom)
{
unsigned char *vto;
vto = kmap_atomic(to->bv_page);
memcpy(vto + to->bv_offset, vfrom, to->bv_len);
kunmap_atomic(vto);
}
/* /*
* Simple bounce buffer support for highmem pages. Depending on the * Simple bounce buffer support for highmem pages. Depending on the
* queue gfp mask set, *to may or may not be a highmem page. kmap it * queue gfp mask set, *to may or may not be a highmem page. kmap it
...@@ -86,7 +74,6 @@ static void bounce_copy_vec(struct bio_vec *to, unsigned char *vfrom) ...@@ -86,7 +74,6 @@ static void bounce_copy_vec(struct bio_vec *to, unsigned char *vfrom)
*/ */
static void copy_to_high_bio_irq(struct bio *to, struct bio *from) static void copy_to_high_bio_irq(struct bio *to, struct bio *from)
{ {
unsigned char *vfrom;
struct bio_vec tovec, fromvec; struct bio_vec tovec, fromvec;
struct bvec_iter iter; struct bvec_iter iter;
/* /*
...@@ -104,11 +91,8 @@ static void copy_to_high_bio_irq(struct bio *to, struct bio *from) ...@@ -104,11 +91,8 @@ static void copy_to_high_bio_irq(struct bio *to, struct bio *from)
* been modified by the block layer, so use the original * been modified by the block layer, so use the original
* copy, bounce_copy_vec already uses tovec->bv_len * copy, bounce_copy_vec already uses tovec->bv_len
*/ */
vfrom = page_address(fromvec.bv_page) + memcpy_to_bvec(&tovec, page_address(fromvec.bv_page) +
tovec.bv_offset; tovec.bv_offset);
bounce_copy_vec(&tovec, vfrom);
flush_dcache_page(tovec.bv_page);
} }
bio_advance_iter(from, &from_iter, tovec.bv_len); bio_advance_iter(from, &from_iter, tovec.bv_len);
} }
......
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