[PATCH 8/8] block: convert md to use blk_kmap helpers

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

 



Convert direct uses of kmap/unmap to blk_kmap/unmap in md.  This
combined with the previous bio helper change fixes PIO cache coherency
bugs on architectures with aliased caches.

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

---

 drivers/md/raid1.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

c781a8f9320246a13cdc62610b314dcd3678266d
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index a06ff91..6a940a1 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -714,13 +714,19 @@ static struct page **alloc_behind_pages(
 		goto do_sync_io;
 
 	bio_for_each_segment(bvec, bio, i) {
+		void *src, *dst;
+
 		pages[i] = alloc_page(GFP_NOIO);
 		if (unlikely(!pages[i]))
 			goto do_sync_io;
-		memcpy(kmap(pages[i]) + bvec->bv_offset,
-			kmap(bvec->bv_page) + bvec->bv_offset, bvec->bv_len);
+
+		src = blk_kmap(bvec->bv_page, DMA_TO_DEVICE) + bvec->bv_offset;
+		dst = kmap(pages[i]) + bvec->bv_offset;
+
+		memcpy(dst, src, bvec->bv_len);
+
+		blk_kunmap(bvec->bv_page, DMA_TO_DEVICE);
 		kunmap(pages[i]);
-		kunmap(bvec->bv_page);
 	}
 
 	return pages;
-- 
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