From patchwork Wed Dec 8 04:22:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12663735 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 BB948C433EF for ; Wed, 8 Dec 2021 06:31:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 419776B0075; Wed, 8 Dec 2021 01:23:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CA7A6B007D; Wed, 8 Dec 2021 01:23:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2698E6B007E; Wed, 8 Dec 2021 01:23:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay025.a.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 14FFA6B0075 for ; Wed, 8 Dec 2021 01:23:46 -0500 (EST) Received: by unirelay01.hostedemail.com (Postfix, from userid 108) id 700236044F; Wed, 8 Dec 2021 05:38:45 +0000 (UTC) Received: by unirelay01.hostedemail.com (Postfix, from userid 108) id 8118B604B4; Wed, 8 Dec 2021 05:32:09 +0000 (UTC) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 9E10F609FF for ; Wed, 8 Dec 2021 04:23:14 +0000 (UTC) X-FDA: 78893332308.18.658103B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP id 356226001983 for ; Wed, 8 Dec 2021 04:23:14 +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=Ffq/cQVPcFt5LoElUBw8aA2bmdFv10SCY9OdwQ5yJQA=; b=ZoCCrfBFGomvt8SJ8oYXyTew2p pDTXUDYEZDZQGTw0CSnLSGvksOSX4S9AYEAh/nNrd7DnRZ+FLb0kWO1KxyChPrtabjtzCd9ZCAcbR wNG90x7cVYy000WVHvgV1SdORhzBmPT3bpVy/BnPRuYJCkqnE3cuOdb98lpKcOQANraMI34RVVoH6 o4y5qvFFLPRKi8n3PwaI0XkqqW4zsLOv4NXx/lAvkeeIUkwx1duj/83q+e/bRFLMwSeVkD9PRLZ+8 iO4yBbRfol1nHLB037r7RlXrN1ddM0xm8/IEy3Jq/MpY6ta65Q88Nsnne18F4SseSNEdyZPf4kpmV ZD3gyquQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1muoU3-0084YC-KU; Wed, 08 Dec 2021 04:23:11 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 18/48] filemap: Convert filemap_read_page to take a folio Date: Wed, 8 Dec 2021 04:22:26 +0000 Message-Id: <20211208042256.1923824-19-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: rspam07 X-Rspamd-Queue-Id: 356226001983 X-Stat-Signature: t5bjk6amm65u71tgx85gge3gjtzbpwth Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ZoCCrfBF; spf=none (imf10.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: 1638937394-765226 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: One of the callers already had a folio; the other two grow by a few bytes, but filemap_read_page() shrinks by 50 bytes for a net reduction of 27 bytes. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/filemap.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 33e638f1ca34..581f9fdb3406 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2369,8 +2369,8 @@ static void filemap_get_read_batch(struct address_space *mapping, rcu_read_unlock(); } -static int filemap_read_page(struct file *file, struct address_space *mapping, - struct page *page) +static int filemap_read_folio(struct file *file, struct address_space *mapping, + struct folio *folio) { int error; @@ -2379,16 +2379,16 @@ static int filemap_read_page(struct file *file, struct address_space *mapping, * eg. multipath errors. PG_error will be set again if readpage * fails. */ - ClearPageError(page); + folio_clear_error(folio); /* Start the actual read. The read will unlock the page. */ - error = mapping->a_ops->readpage(file, page); + error = mapping->a_ops->readpage(file, &folio->page); if (error) return error; - error = wait_on_page_locked_killable(page); + error = folio_wait_locked_killable(folio); if (error) return error; - if (PageUptodate(page)) + if (folio_test_uptodate(folio)) return 0; shrink_readahead_size_eio(&file->f_ra); return -EIO; @@ -2464,7 +2464,7 @@ static int filemap_update_page(struct kiocb *iocb, if (iocb->ki_flags & (IOCB_NOIO | IOCB_NOWAIT | IOCB_WAITQ)) goto unlock; - error = filemap_read_page(iocb->ki_filp, mapping, &folio->page); + error = filemap_read_folio(iocb->ki_filp, mapping, folio); goto unlock_mapping; unlock: folio_unlock(folio); @@ -2506,7 +2506,7 @@ static int filemap_create_page(struct file *file, if (error) goto error; - error = filemap_read_page(file, mapping, page); + error = filemap_read_folio(file, mapping, page_folio(page)); if (error) goto error; @@ -3168,7 +3168,7 @@ vm_fault_t filemap_fault(struct vm_fault *vmf) * and we need to check for errors. */ fpin = maybe_unlock_mmap_for_io(vmf, fpin); - error = filemap_read_page(file, mapping, page); + error = filemap_read_folio(file, mapping, page_folio(page)); if (fpin) goto out_retry; put_page(page);