Commit 6e0a4855 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

ps3disk: use memcpy_{from,to}_bvec

Use the bvec helpers instead of open coding the copy.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Tested-by: default avatarGeoff Levand <geoff@infradead.org>
Link: https://lore.kernel.org/r/20210727055646.118787-9-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 18a6234c
...@@ -83,26 +83,12 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev, ...@@ -83,26 +83,12 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev,
unsigned int offset = 0; unsigned int offset = 0;
struct req_iterator iter; struct req_iterator iter;
struct bio_vec bvec; struct bio_vec bvec;
unsigned int i = 0;
size_t size;
void *buf;
rq_for_each_segment(bvec, req, iter) { rq_for_each_segment(bvec, req, iter) {
unsigned long flags;
dev_dbg(&dev->sbd.core, "%s:%u: bio %u: %u sectors from %llu\n",
__func__, __LINE__, i, bio_sectors(iter.bio),
iter.bio->bi_iter.bi_sector);
size = bvec.bv_len;
buf = bvec_kmap_irq(&bvec, &flags);
if (gather) if (gather)
memcpy(dev->bounce_buf+offset, buf, size); memcpy_from_bvec(dev->bounce_buf + offset, &bvec);
else else
memcpy(buf, dev->bounce_buf+offset, size); memcpy_to_bvec(&bvec, dev->bounce_buf + offset);
offset += size;
flush_kernel_dcache_page(bvec.bv_page);
bvec_kunmap_irq(buf, &flags);
i++;
} }
} }
......
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