Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2553978pxa; Mon, 24 Aug 2020 18:21:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzU54NxWSzUsrdRExxaUmXGZWwGNaPWU0RdcucZ06i7gHS+4kh83Ale6jxN2PxdiuCpvoju X-Received: by 2002:a50:d80f:: with SMTP id o15mr8138316edj.156.1598318495829; Mon, 24 Aug 2020 18:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598318495; cv=none; d=google.com; s=arc-20160816; b=QoNVrfaamr6X263syGHEpBKaSOOx3K/tk7tX8OCE49E6to/Flq5z0vpn8JH63CZ5/a x+ESPvjJC5E8xovEEPZqQiRXfWz0C1cyYydZsYeqd/40wLyJQg2JYIBTkI8TQaM3wCCV FwJUwKUvK7KRoMFvqC57DB+4rDFoRzRm7JkK0tHlKs5D3j+GDcwvPV6NO24iPgv6EFUO WWAN+2cX8Drrtjr7nAjufAPxPEOG2rF9vBVfTVyTxzS4jn0GOT1psdfe0DXz/8FsHh6f 5AWkIcWaAaXxLqu+Xxw20h4Ao57Vqtr9CxdSuEv8QowzHKlGZWB+lJP5r4lLmsTRraWX 475A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=LeU6AwNAplziQ2ZfUIYvJCauSoR/ekxkghoX0Pth920=; b=s61+XGqLPWWBlePLG2uym/HnW4IFYZVoW9fLofZd02XSJflcIrYhIH0I/VBSmrn5vg q5YNGgkCzsYbclP69i/QqKrE6FS0X5XbIGP5BmahOavJYqKErn/Ke0Ad6PJpP2R5Npgf MWKxMWl22QT4jbNj9Y/8Xtk4RuZknC2xUxKTD7jkS005WEpM0sOjzLC9YRZ/NMuGaHFg 1yLGkdHu7sgqQ1vgInCcLgeEN2+w6IXJvILzPAfysUvSVaoi4qZu1OfmZps9Ii5Yjfhc Y0B3ocF5osXiXeWSMMyMEE3FWKW/EZcKgJMhoboxkFy15mqSf+WNMjh8xh83aukO7VN8 nXtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=dJbhxmWV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si8948208ejl.636.2020.08.24.18.21.13; Mon, 24 Aug 2020 18:21:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=dJbhxmWV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728405AbgHYBUl (ORCPT + 99 others); Mon, 24 Aug 2020 21:20:41 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:5098 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726041AbgHYBUj (ORCPT ); Mon, 24 Aug 2020 21:20:39 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 24 Aug 2020 18:18:39 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 24 Aug 2020 18:20:38 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 24 Aug 2020 18:20:38 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 25 Aug 2020 01:20:38 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 25 Aug 2020 01:20:38 +0000 Received: from sandstorm.nvidia.com (Not Verified[10.2.53.36]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 24 Aug 2020 18:20:38 -0700 From: John Hubbard To: , CC: , , , , , , , , , , , Subject: [PATCH v2] fs/ceph: use pipe_get_pages_alloc() for pipe Date: Mon, 24 Aug 2020 18:20:34 -0700 Message-ID: <20200825012034.1962362-1-jhubbard@nvidia.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200824185400.GE17456@casper.infradead.org> References: <20200824185400.GE17456@casper.infradead.org> MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1598318319; bh=LeU6AwNAplziQ2ZfUIYvJCauSoR/ekxkghoX0Pth920=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:X-NVConfidentiality: Content-Transfer-Encoding:Content-Type; b=dJbhxmWVHB+ywuKvGhuzf3w1LZCEDf94YUwqDRfe9Q2Hr5/ds8ADrW5U+JzneKhXj npXXJ055Qgt5hE0X44gz/QtrW2vXHRX9yuixWIiZnaM1olwc9O8Yj5U/4KTZmfiHeY L/FC1LzwJsP6oTtzCYXH7Db7JrI54OthDvtnrk9EEJyg0tFZEpjiCU63NhQ/VmmuLE uBZO7o5iBq6kpernShLqsNSEUmioemlhLvSfLCu2/2OAFEmodXF1Hn3H8cJaiEzrOx OJWeBkzB6k6g6xYbUbzW/gBylQgHQAh367suhEv6p2S93O5intO7INmut3vnXhXTAp IMSDCnFxRuYcw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reduces, by one, the number of callers of iov_iter_get_pages(). That's helpful because these calls are being audited and converted over to use iov_iter_pin_user_pages(), where applicable. And this one here is already known by the caller to be only for ITER_PIPE, so let's just simplify it now. Signed-off-by: John Hubbard --- OK, here's a v2 that does EXPORT_SYMBOL_GPL, instead of EXPORT_SYMBOL, that's the only change from v1. That should help give this patch a clear bill of passage. :) thanks, John Hubbard NVIDIA fs/ceph/file.c | 3 +-- include/linux/uio.h | 3 ++- lib/iov_iter.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index d51c3f2fdca0..d3d7dd957390 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -879,8 +879,7 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struc= t iov_iter *to, more =3D len < iov_iter_count(to); =20 if (unlikely(iov_iter_is_pipe(to))) { - ret =3D iov_iter_get_pages_alloc(to, &pages, len, - &page_off); + ret =3D pipe_get_pages_alloc(to, &pages, len, &page_off); if (ret <=3D 0) { ceph_osdc_put_request(req); ret =3D -ENOMEM; diff --git a/include/linux/uio.h b/include/linux/uio.h index 3835a8a8e9ea..270a4dcf5453 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -226,7 +226,8 @@ ssize_t iov_iter_get_pages(struct iov_iter *i, struct p= age **pages, ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, size_t maxsize, size_t *start); int iov_iter_npages(const struct iov_iter *i, int maxpages); - +ssize_t pipe_get_pages_alloc(struct iov_iter *i, struct page ***pages, + size_t maxsize, size_t *start); const void *dup_iter(struct iov_iter *new, struct iov_iter *old, gfp_t fla= gs); =20 static inline size_t iov_iter_count(const struct iov_iter *i) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 5e40786c8f12..6290998df480 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1355,9 +1355,8 @@ static struct page **get_pages_array(size_t n) return kvmalloc_array(n, sizeof(struct page *), GFP_KERNEL); } =20 -static ssize_t pipe_get_pages_alloc(struct iov_iter *i, - struct page ***pages, size_t maxsize, - size_t *start) +ssize_t pipe_get_pages_alloc(struct iov_iter *i, struct page ***pages, + size_t maxsize, size_t *start) { struct page **p; unsigned int iter_head, npages; @@ -1387,6 +1386,7 @@ static ssize_t pipe_get_pages_alloc(struct iov_iter *= i, kvfree(p); return n; } +EXPORT_SYMBOL_GPL(pipe_get_pages_alloc); =20 ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, size_t maxsize, --=20 2.28.0