Commit 732022b8 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

rbd: use memzero_bvec

Use memzero_bvec instead of reimplementing it.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarIlya Dryomov <idryomov@gmail.com>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20210727055646.118787-7-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ab6c340e
...@@ -1219,24 +1219,13 @@ static void rbd_dev_mapping_clear(struct rbd_device *rbd_dev) ...@@ -1219,24 +1219,13 @@ static void rbd_dev_mapping_clear(struct rbd_device *rbd_dev)
rbd_dev->mapping.size = 0; rbd_dev->mapping.size = 0;
} }
static void zero_bvec(struct bio_vec *bv)
{
void *buf;
unsigned long flags;
buf = bvec_kmap_irq(bv, &flags);
memset(buf, 0, bv->bv_len);
flush_dcache_page(bv->bv_page);
bvec_kunmap_irq(buf, &flags);
}
static void zero_bios(struct ceph_bio_iter *bio_pos, u32 off, u32 bytes) static void zero_bios(struct ceph_bio_iter *bio_pos, u32 off, u32 bytes)
{ {
struct ceph_bio_iter it = *bio_pos; struct ceph_bio_iter it = *bio_pos;
ceph_bio_iter_advance(&it, off); ceph_bio_iter_advance(&it, off);
ceph_bio_iter_advance_step(&it, bytes, ({ ceph_bio_iter_advance_step(&it, bytes, ({
zero_bvec(&bv); memzero_bvec(&bv);
})); }));
} }
...@@ -1246,7 +1235,7 @@ static void zero_bvecs(struct ceph_bvec_iter *bvec_pos, u32 off, u32 bytes) ...@@ -1246,7 +1235,7 @@ static void zero_bvecs(struct ceph_bvec_iter *bvec_pos, u32 off, u32 bytes)
ceph_bvec_iter_advance(&it, off); ceph_bvec_iter_advance(&it, off);
ceph_bvec_iter_advance_step(&it, bytes, ({ ceph_bvec_iter_advance_step(&it, bytes, ({
zero_bvec(&bv); memzero_bvec(&bv);
})); }));
} }
......
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