]> www.infradead.org Git - users/hch/block.git/commitdiff
block: use memzero_page in zero_fill_bio
authorChristoph Hellwig <hch@lst.de>
Thu, 20 May 2021 12:06:10 +0000 (14:06 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 20 May 2021 12:44:57 +0000 (14:44 +0200)
Use memzero_bvec to zero each segment in the bio instead of manually
mapping and zeroing the data.

Signed-off-by: Christoph Hellwig <hch@lst.de>
block/bio.c

index 44205dfb6b60aaa5c5f7a8c4aa176176a1907412..1d7abdb83a39156efc09f27eeef287480f45d6d4 100644 (file)
@@ -495,16 +495,11 @@ EXPORT_SYMBOL(bio_kmalloc);
 
 void zero_fill_bio(struct bio *bio)
 {
-       unsigned long flags;
        struct bio_vec bv;
        struct bvec_iter iter;
 
-       bio_for_each_segment(bv, bio, iter) {
-               char *data = bvec_kmap_irq(&bv, &flags);
-               memset(data, 0, bv.bv_len);
-               flush_dcache_page(bv.bv_page);
-               bvec_kunmap_irq(data, &flags);
-       }
+       bio_for_each_segment(bv, bio, iter)
+               memzero_bvec(&bv);
 }
 EXPORT_SYMBOL(zero_fill_bio);