[PATCH v3 09/11] block: convert kmap helpers to kmap_atomic_pfn_t()

From: Dan Williams
Date: Tue May 12 2015 - 00:33:14 EST


Convert the generic helpers to the __pfn_t version of kmap_atomic() in
support of generically enabling "page-less" block i/o.

Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
---
include/linux/bio.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/linux/bio.h b/include/linux/bio.h
index a569e6ea1cd2..6537d78e78b3 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -161,7 +161,7 @@ static inline void *bio_data(struct bio *bio)
* I/O completely on that queue (see ide-dma for example)
*/
#define __bio_kmap_atomic(bio, iter) \
- (kmap_atomic(bvec_page(bio_iter_iovec((bio), (iter)))) + \
+ (kmap_atomic_pfn_t(bio_iter_iovec((bio), (iter)).pfn) + \
bio_iter_iovec((bio), (iter)).bv_offset)

#define __bio_kunmap_atomic(addr) kunmap_atomic(addr)
@@ -491,7 +491,7 @@ static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
* balancing is a lot nicer this way
*/
local_irq_save(*flags);
- addr = (unsigned long) kmap_atomic(bvec_page(bvec));
+ addr = (unsigned long) kmap_atomic_pfn_t(bvec.pfn);

BUG_ON(addr & ~PAGE_MASK);

@@ -502,18 +502,21 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
{
unsigned long ptr = (unsigned long) buffer & PAGE_MASK;

- kunmap_atomic((void *) ptr);
+ kunmap_atomic_pfn_t((void *) ptr);
local_irq_restore(*flags);
}

#else
static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
{
- return page_address(bvec_page(bvec)) + bvec->bv_offset;
+ return kmap_atomic_pfn_t(bvec->bv_pfn) + bvec->bv_offset;
}

static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
{
+ unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
+
+ kunmap_atomic_pfn_t((void *) ptr);
*flags = 0;
}
#endif

--
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/