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

From: Tejun Heo
Date: Fri Jan 13 2006 - 10:25:36 EST


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 <htejun@xxxxxxxxx>

---

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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/