提交 bd3d3203 编写于 作者: C Christoph Hellwig 提交者: Jens Axboe

zram: use memcpy_from_bvec in zram_bvec_write

Use memcpy_from_bvec instead of open coding the logic.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NIra Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20220303111905.321089-5-hch@lst.deSigned-off-by: NJens Axboe <axboe@kernel.dk>
上级 b3bd0a8a
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册