lkml.org 
[lkml]   [2013]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V6 08/30] iov_iter: let callers extract iovecs and bio_vecs
Date
From: Zach Brown <zab@zabbo.net>

direct IO treats memory from user iovecs and memory from arrays of
kernel pages very differently. User memory is pinned and worked with in
batches while kernel pages are always pinned and don't require
additional processing.

Rather than try and provide an abstraction that includes these
different behaviours we let direct IO extract the memory structs and
hand them to the existing code.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Zach Brown <zab@zabbo.net>
---
include/linux/fs.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index cc4ed53..eb564d1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -365,6 +365,17 @@ static inline void iov_iter_init_bvec(struct iov_iter *i,

iov_iter_advance(i, written);
}
+
+static inline int iov_iter_has_bvec(struct iov_iter *i)
+{
+ return i->ops == &ii_bvec_ops;
+}
+
+static inline struct bio_vec *iov_iter_bvec(struct iov_iter *i)
+{
+ BUG_ON(!iov_iter_has_bvec(i));
+ return (struct bio_vec *)i->data;
+}
#endif

extern struct iov_iter_ops ii_iovec_ops;
@@ -382,8 +393,14 @@ static inline void iov_iter_init(struct iov_iter *i,
iov_iter_advance(i, written);
}

+static inline int iov_iter_has_iovec(struct iov_iter *i)
+{
+ return i->ops == &ii_iovec_ops;
+}
+
static inline struct iovec *iov_iter_iovec(struct iov_iter *i)
{
+ BUG_ON(!iov_iter_has_iovec(i));
return (struct iovec *)i->data;
}

--
1.8.1.1


\
 
 \ /
  Last update: 2013-01-29 18:02    [W:0.131 / U:1.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site