lkml.org 
[lkml]   [2015]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH v3 09/11] block: convert kmap helpers to kmap_atomic_pfn_t()
From
Date
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@intel.com>
---
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


\
 
 \ /
  Last update: 2015-05-12 06:41    [W:0.369 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site