diff options
author | Christoph Hellwig <hch@lst.de> | 2022-03-03 14:18:59 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-03-04 12:29:21 -0700 |
commit | bd3d3203eb84d08a6daef805efe9316b79d3bf3c (patch) | |
tree | e08f3eeffa203fecf25e552f6ce35b2049af64d8 /drivers/block | |
parent | b3bd0a8a74ab970cc1cf0849e66bd0906741105b (diff) | |
download | lwn-bd3d3203eb84d08a6daef805efe9316b79d3bf3c.tar.gz lwn-bd3d3203eb84d08a6daef805efe9316b79d3bf3c.zip |
zram: use memcpy_from_bvec in zram_bvec_write
Use memcpy_from_bvec instead of open coding the logic.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20220303111905.321089-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/zram/zram_drv.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 14becdf2815d..e9474b02012d 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1465,7 +1465,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, { int ret; struct page *page = NULL; - void *src; struct bio_vec vec; vec = *bvec; @@ -1483,11 +1482,9 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, if (ret) goto out; - src = kmap_atomic(bvec->bv_page); dst = kmap_atomic(page); - memcpy(dst + offset, src + bvec->bv_offset, bvec->bv_len); + memcpy_from_bvec(dst + offset, bvec); kunmap_atomic(dst); - kunmap_atomic(src); vec.bv_page = page; vec.bv_len = PAGE_SIZE; |