]> www.infradead.org Git - users/hch/block.git/commitdiff
ps3disk: use memcpy_{from,to}_bvec
authorChristoph Hellwig <hch@lst.de>
Thu, 20 May 2021 12:14:43 +0000 (14:14 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 21 May 2021 05:55:25 +0000 (07:55 +0200)
Use the bvec helpers instead of open coding the copy.

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

index ba3ece56cbb33874f76d95f558a419d8334ffa79..f3ed4d731a27b0bc12e8b7ef52e858c52821dd24 100644 (file)
@@ -84,26 +84,13 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev,
        unsigned int offset = 0;
        struct req_iterator iter;
        struct bio_vec bvec;
-       unsigned int i = 0;
-       size_t size;
-       void *buf;
 
        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)
-                       memcpy(dev->bounce_buf+offset, buf, size);
+                       memcpy_from_bvec(dev->bounce_buf + offset, &bvev)
                else
-                       memcpy(buf, dev->bounce_buf+offset, size);
-               offset += size;
-               flush_kernel_dcache_page(bvec.bv_page);
-               bvec_kunmap_irq(buf, &flags);
-               i++;
+                       memcpy_to_bvec(&bvev, dev->bounce_buf + offset);
+               offset += bvec.bv_len;
        }
 }