Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932360Ab3GYSE0 (ORCPT ); Thu, 25 Jul 2013 14:04:26 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:19897 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756978Ab3GYRwC (ORCPT ); Thu, 25 Jul 2013 13:52:02 -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 02/33] iov_iter: iov_iter_copy_from_user() should use non-atomic copy Date: Thu, 25 Jul 2013 12:50:28 -0500 Message-Id: <1374774659-13121-3-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: ucsinet21.oracle.com [156.151.31.93] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2032 Lines: 62 Signed-off-by: Dave Kleikamp --- fs/iov-iter.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/fs/iov-iter.c b/fs/iov-iter.c index 52c23d9..563a6ba 100644 --- a/fs/iov-iter.c +++ b/fs/iov-iter.c @@ -6,8 +6,8 @@ #include #include -static size_t __iovec_copy_from_user_inatomic(char *vaddr, - const struct iovec *iov, size_t base, size_t bytes) +static size_t __iovec_copy_from_user(char *vaddr, const struct iovec *iov, + size_t base, size_t bytes, int atomic) { size_t copied = 0, left = 0; @@ -16,7 +16,10 @@ static size_t __iovec_copy_from_user_inatomic(char *vaddr, int copy = min(bytes, iov->iov_len - base); base = 0; - left = __copy_from_user_inatomic(vaddr, buf, copy); + if (atomic) + left = __copy_from_user_inatomic(vaddr, buf, copy); + else + left = __copy_from_user(vaddr, buf, copy); copied += copy; bytes -= copy; vaddr += copy; @@ -47,8 +50,8 @@ size_t iov_iter_copy_from_user_atomic(struct page *page, left = __copy_from_user_inatomic(kaddr + offset, buf, bytes); copied = bytes - left; } else { - copied = __iovec_copy_from_user_inatomic(kaddr + offset, - i->iov, i->iov_offset, bytes); + copied = __iovec_copy_from_user(kaddr + offset, i->iov, + i->iov_offset, bytes, 1); } kunmap_atomic(kaddr); @@ -75,8 +78,8 @@ size_t iov_iter_copy_from_user(struct page *page, left = __copy_from_user(kaddr + offset, buf, bytes); copied = bytes - left; } else { - copied = __iovec_copy_from_user_inatomic(kaddr + offset, - i->iov, i->iov_offset, bytes); + copied = __iovec_copy_from_user(kaddr + offset, i->iov, + i->iov_offset, bytes, 0); } kunmap(page); return copied; -- 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/