Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757122Ab3GYRwW (ORCPT ); Thu, 25 Jul 2013 13:52:22 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:43478 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757011Ab3GYRwF (ORCPT ); Thu, 25 Jul 2013 13:52:05 -0400 From: Dave Kleikamp To: linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, Andrew Morton , "Maxim V. Patlasov" , Zach Brown , Dave Kleikamp Subject: [PATCH V8 10/33] iov_iter: let callers extract iovecs and bio_vecs Date: Thu, 25 Jul 2013 12:50:36 -0500 Message-Id: <1374774659-13121-11-git-send-email-dave.kleikamp@oracle.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1374774659-13121-1-git-send-email-dave.kleikamp@oracle.com> References: <1374774659-13121-1-git-send-email-dave.kleikamp@oracle.com> X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1745 Lines: 62 From: Zach Brown 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 Cc: Zach Brown --- include/linux/fs.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/fs.h b/include/linux/fs.h index a89bcb9..322d585 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -371,6 +371,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; @@ -388,8 +399,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.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/