From patchwork Thu Jul 15 03:36:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12378905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7107FC07E96 for ; Thu, 15 Jul 2021 05:12:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 010B061278 for ; Thu, 15 Jul 2021 05:12:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 010B061278 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5AAEE8D0079; Thu, 15 Jul 2021 01:12:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 55AAD8D0065; Thu, 15 Jul 2021 01:12:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 422E48D0079; Thu, 15 Jul 2021 01:12:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0161.hostedemail.com [216.40.44.161]) by kanga.kvack.org (Postfix) with ESMTP id 2077B8D0065 for ; Thu, 15 Jul 2021 01:12:11 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 092DB2311F for ; Thu, 15 Jul 2021 05:12:10 +0000 (UTC) X-FDA: 78363650820.05.C5B6752 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id B9762F000095 for ; Thu, 15 Jul 2021 05:12:09 +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=9RHYJbjPvnqicnRJcqR3syd4A7W3DXyDdvohNQa07JI=; b=Zj8UrZa7kSb9ZwkzDckQztJeFe R4tDSJ8RkEAG1IPNgOo8dEsqucfYgosHHX6oGjHL2aHTMwidm6W6Habvk1966Gz3QJXSE+lNfFKDg wq7lMx/m8maoTG3TzNBAbEf1ooCAxFRk6BooKtLto9oqR/ppDlR8JRnPylYlwzV9xZQyHQzLpWoPp i/v87a/rqNdTD/TDp1QsJsXztDv88/I0NnpnKgX8wCNm77Xn0VQx3bsQ30LI6ghO53pNoGzUpmfRk +2RTV7VdZbJ6hx6ggCR4PT6RpXWff9FfYis4+Jr/2jXsePOfjkUtzSrrpx0VtUPFSScpHHZ4iPbtL Wdw2zBzg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3tdc-0030Dm-Nl; Thu, 15 Jul 2021 05:10:31 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v14 115/138] mm/filemap: Convert filemap_create_page to folio Date: Thu, 15 Jul 2021 04:36:41 +0100 Message-Id: <20210715033704.692967-116-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210715033704.692967-1-willy@infradead.org> References: <20210715033704.692967-1-willy@infradead.org> MIME-Version: 1.0 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Zj8UrZa7; spf=none (imf16.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-Rspamd-Server: rspam02 X-Stat-Signature: ktkwap1ctwrxzxjqfkebmi49cam8xqfc X-Rspamd-Queue-Id: B9762F000095 X-HE-Tag: 1626325929-621672 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 is all internal to filemap and saves 100 bytes of text. Signed-off-by: Matthew Wilcox (Oracle) --- mm/filemap.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 5e2a2db1c715..7eda9afb0600 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2396,32 +2396,32 @@ static int filemap_update_page(struct kiocb *iocb, return error; } -static int filemap_create_page(struct file *file, +static int filemap_create_folio(struct file *file, struct address_space *mapping, pgoff_t index, struct pagevec *pvec) { - struct page *page; + struct folio *folio; int error; - page = page_cache_alloc(mapping); - if (!page) + folio = filemap_alloc_folio(mapping_gfp_mask(mapping), 0); + if (!folio) return -ENOMEM; - error = add_to_page_cache_lru(page, mapping, index, + error = filemap_add_folio(mapping, folio, index, mapping_gfp_constraint(mapping, GFP_KERNEL)); if (error == -EEXIST) error = AOP_TRUNCATED_PAGE; if (error) goto error; - error = filemap_read_folio(file, mapping, page_folio(page)); + error = filemap_read_folio(file, mapping, folio); if (error) goto error; - pagevec_add(pvec, page); + pagevec_add(pvec, &folio->page); return 0; error: - put_page(page); + folio_put(folio); return error; } @@ -2463,7 +2463,7 @@ static int filemap_get_pages(struct kiocb *iocb, struct iov_iter *iter, if (!pagevec_count(pvec)) { if (iocb->ki_flags & (IOCB_NOWAIT | IOCB_WAITQ)) return -EAGAIN; - err = filemap_create_page(filp, mapping, + err = filemap_create_folio(filp, mapping, iocb->ki_pos >> PAGE_SHIFT, pvec); if (err == AOP_TRUNCATED_PAGE) goto retry;