From patchwork Wed Dec 8 04:22:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12663751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4285C433EF for ; Wed, 8 Dec 2021 06:44:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C38666B0071; Wed, 8 Dec 2021 01:43:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B02176B0073; Wed, 8 Dec 2021 01:43:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8929F6B0075; Wed, 8 Dec 2021 01:43:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay037.a.hostedemail.com [64.99.140.37]) by kanga.kvack.org (Postfix) with ESMTP id 6F7A76B0074 for ; Wed, 8 Dec 2021 01:43:35 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 8F490601A9 for ; Wed, 8 Dec 2021 04:23:15 +0000 (UTC) X-FDA: 78893332308.14.A5FBA89 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf05.hostedemail.com (Postfix) with ESMTP id 36AEC100005 for ; Wed, 8 Dec 2021 04:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=FDCiLoAhGLqsIRLI+os8SCB3HaHnYoT1HRwaxkznZEo=; b=SUwz0gekB4isoCrRAe5K1ZGvSk OYuTW31exgXmtNmi9vW4IUW0++ptqAaP9fZkdGZfYkixDXZ3tcDh7/OtGSqzMGiYGRaxEm24M3Xrj DfHG/0gJuHAasLwTjvHs+pAZq+0CKLDIDPIZD0wHXxiNH1vqNzVX2X//wsBKygCgKOxUe0i4qU5Rg X5IInjCg+2jJ58TtlY2fknclLxAuoKJJ2vC0eaK6o3u+3ViB7SvpsbLUbjeQWzN+D0fVrkGd640lP Fup2dHKcWSEcw7WgvF1epiGeXjVmlE9opOyZEYFSBq1V6INxNpc/18dfwTL1GsCK0haFOre3HnzLy zHJaJbfw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1muoU2-0084X2-1I; Wed, 08 Dec 2021 04:23:10 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 06/48] iov_iter: Add copy_folio_to_iter() Date: Wed, 8 Dec 2021 04:22:14 +0000 Message-Id: <20211208042256.1923824-7-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211208042256.1923824-1-willy@infradead.org> References: <20211208042256.1923824-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 36AEC100005 X-Stat-Signature: saewjfu81qdgeejsyadggin6c6waxkij Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=SUwz0gek; spf=none (imf05.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1638937392-16706 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This wrapper around copy_page_to_iter() works because copy_page_to_iter() handles compound pages correctly. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/uio.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index 6350354f97e9..8479cf46b5b1 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -10,6 +10,7 @@ #include struct page; +struct folio; struct pipe_inode_info; struct kvec { @@ -146,6 +147,12 @@ size_t _copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i); size_t _copy_from_iter(void *addr, size_t bytes, struct iov_iter *i); size_t _copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i); +static inline size_t copy_folio_to_iter(struct folio *folio, size_t offset, + size_t bytes, struct iov_iter *i) +{ + return copy_page_to_iter((struct page *)folio, offset, bytes, i); +} + static __always_inline __must_check size_t copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i) {