[PATCH 7/8] block: convert block/rd.c to use blk_kmap helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Convert block/rd.c to use blk_kmap/unmap helpers.  rd already had all
needed cache flushes, so this patch doesn't change its functionality.

Signed-off-by: Tejun Heo <[email protected]>

---

 drivers/block/rd.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

f09db99a6eb5be8a6a793c3a73e1457bfa61c928
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index ffd6abd..d0ff693 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -232,9 +232,11 @@ static int rd_blkdev_pagecache_IO(int rw
 
 		if (rw == READ) {
 			src = kmap_atomic(page, KM_USER0) + offset;
-			dst = kmap_atomic(vec->bv_page, KM_USER1) + vec_offset;
+			dst = blk_kmap_atomic(vec->bv_page, KM_USER1,
+					      DMA_FROM_DEVICE) + vec_offset;
 		} else {
-			src = kmap_atomic(vec->bv_page, KM_USER0) + vec_offset;
+			src = blk_kmap_atomic(vec->bv_page, KM_USER0,
+					      DMA_TO_DEVICE) + vec_offset;
 			dst = kmap_atomic(page, KM_USER1) + offset;
 		}
 		offset = 0;
@@ -242,13 +244,14 @@ static int rd_blkdev_pagecache_IO(int rw
 
 		memcpy(dst, src, count);
 
-		kunmap_atomic(src, KM_USER0);
-		kunmap_atomic(dst, KM_USER1);
-
-		if (rw == READ)
-			flush_dcache_page(vec->bv_page);
-		else
+		if (rw == READ) {
+			kunmap_atomic(src, KM_USER0);
+			blk_kunmap_atomic(dst, KM_USER1, DMA_FROM_DEVICE);
+		} else {
+			blk_kunmap_atomic(src, KM_USER0, DMA_TO_DEVICE);
+			kunmap_atomic(dst, KM_USER1);
 			set_page_dirty(page);
+		}
 		unlock_page(page);
 		put_page(page);
 	} while (size);
-- 
1.0.6


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux