[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210727055646.118787-14-hch@lst.de>
Date: Tue, 27 Jul 2021 07:56:44 +0200
From: Christoph Hellwig <hch@....de>
To: Jens Axboe <axboe@...nel.dk>, Thomas Gleixner <tglx@...utronix.de>
Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Geoff Levand <geoff@...radead.org>,
Ilya Dryomov <idryomov@...il.com>,
Dongsheng Yang <dongsheng.yang@...ystack.cn>,
Mike Snitzer <snitzer@...hat.com>,
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
Ira Weiny <ira.weiny@...el.com>, dm-devel@...hat.com,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-block@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
ceph-devel@...r.kernel.org, linux-arch@...r.kernel.org,
"Martin K . Petersen" <martin.petersen@...cle.com>
Subject: [PATCH 13/15] block: use memcpy_from_bvec in __blk_queue_bounce
Rewrite the actual bounce buffering loop in __blk_queue_bounce to that
the memcpy_to_bvec helper can be used to perform the data copies.
Signed-off-by: Christoph Hellwig <hch@....de>
Reviewed-by: Martin K. Petersen <martin.petersen@...cle.com>
---
block/bounce.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/block/bounce.c b/block/bounce.c
index 7e9e666c04dc..05fc7148489d 100644
--- a/block/bounce.c
+++ b/block/bounce.c
@@ -239,24 +239,19 @@ void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig)
* because the 'bio' is single-page bvec.
*/
for (i = 0, to = bio->bi_io_vec; i < bio->bi_vcnt; to++, i++) {
- struct page *page = to->bv_page;
+ struct page *bounce_page;
- if (!PageHighMem(page))
+ if (!PageHighMem(to->bv_page))
continue;
- to->bv_page = mempool_alloc(&page_pool, GFP_NOIO);
- inc_zone_page_state(to->bv_page, NR_BOUNCE);
+ bounce_page = mempool_alloc(&page_pool, GFP_NOIO);
+ inc_zone_page_state(bounce_page, NR_BOUNCE);
if (rw == WRITE) {
- char *vto, *vfrom;
-
- flush_dcache_page(page);
-
- vto = page_address(to->bv_page) + to->bv_offset;
- vfrom = kmap_atomic(page) + to->bv_offset;
- memcpy(vto, vfrom, to->bv_len);
- kunmap_atomic(vfrom);
+ flush_dcache_page(to->bv_page);
+ memcpy_from_bvec(page_address(bounce_page), to);
}
+ to->bv_page = bounce_page;
}
trace_block_bio_bounce(*bio_orig);
--
2.30.2
Powered by blists - more mailing lists