From patchwork Wed Dec 8 04:22:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12663801 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 B8154C433F5 for ; Wed, 8 Dec 2021 06:59:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 302926B0074; Wed, 8 Dec 2021 01:58:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B1E36B0075; Wed, 8 Dec 2021 01:58:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A1936B0078; Wed, 8 Dec 2021 01:58:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay031.a.hostedemail.com [64.99.140.31]) by kanga.kvack.org (Postfix) with ESMTP id 0B05B6B0074 for ; Wed, 8 Dec 2021 01:58:36 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 4A3881201CA for ; Wed, 8 Dec 2021 04:29:13 +0000 (UTC) X-FDA: 78893347386.09.ADA7689 Received: from relay.hostedemail.com (relay038.a.hostedemail.com [64.99.140.38]) by imf27.hostedemail.com (Postfix) with ESMTP id CE8BB7000081 for ; Wed, 8 Dec 2021 04:29:12 +0000 (UTC) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3A02021330 for ; Wed, 8 Dec 2021 04:23:15 +0000 (UTC) X-FDA: 78893332350.30.4CB1A48 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf29.hostedemail.com (Postfix) with ESMTP id AAEA0900024B 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=9Lt8nc8uCMiQ8EPI8aySjPso9UmiJ/85df+p8gpiD3U=; b=AHmJb0PrliFHPV1qjvwMrHEgRi tlvRWFkKM0IIz4vb7L6CaAPw2xP4EOqY+wxsUDTsWGc7DVkTncS3O0D4pG1ZOvmGxspAOukzy8lVn iubvMLqDUsr/OSSNmjYBmkk++4JIax4FU2qUEVSkXrb+wf/+JOBHAha7El/eiVcRIlmlHixtgv2KE IOQaDpM1V+3ZQhiMHHtGBRnkXnrhQF5cwocnlzcCGs48XU90nYNl5o/c1jqwidWYckvfEeRLSmySM 51lrPiLtunEKoIElPXZ3iPbLNOhZo6MyJLhqWlUse4N/T8r2yUfi/gDel8+W1/9ar7Kd12jSCkgOY NO9nNVtQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1muoU4-0084YZ-0R; Wed, 08 Dec 2021 04:23:12 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 21/48] readahead: Convert page_cache_async_ra() to take a folio Date: Wed, 8 Dec 2021 04:22:29 +0000 Message-Id: <20211208042256.1923824-22-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-Stat-Signature: kkowz5owy8dp6dhzc1whdxy37sj8f47g Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=AHmJb0Pr; dmarc=none; spf=none (imf27.hostedemail.com: domain of FILTER%willy@infradead.org has no SPF policy when checking 64.99.140.38) smtp.mailfrom=FILTER%willy@infradead.org X-HE-Tag-Orig: 1638937394-898505 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: CE8BB7000081 X-HE-Tag: 1638937752-421126 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: Using the folio here avoids checking whether it's a tail page. This patch mostly just enables some of the following patches. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- include/linux/pagemap.h | 4 ++-- mm/readahead.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 8c2cad7f0c36..30302be6977f 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -993,7 +993,7 @@ struct readahead_control { void page_cache_ra_unbounded(struct readahead_control *, unsigned long nr_to_read, unsigned long lookahead_count); void page_cache_sync_ra(struct readahead_control *, unsigned long req_count); -void page_cache_async_ra(struct readahead_control *, struct page *, +void page_cache_async_ra(struct readahead_control *, struct folio *, unsigned long req_count); void readahead_expand(struct readahead_control *ractl, loff_t new_start, size_t new_len); @@ -1040,7 +1040,7 @@ void page_cache_async_readahead(struct address_space *mapping, struct page *page, pgoff_t index, unsigned long req_count) { DEFINE_READAHEAD(ractl, file, ra, mapping, index); - page_cache_async_ra(&ractl, page, req_count); + page_cache_async_ra(&ractl, page_folio(page), req_count); } static inline struct folio *__readahead_folio(struct readahead_control *ractl) diff --git a/mm/readahead.c b/mm/readahead.c index 6ae5693de28c..e48e78641772 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -581,7 +581,7 @@ void page_cache_sync_ra(struct readahead_control *ractl, EXPORT_SYMBOL_GPL(page_cache_sync_ra); void page_cache_async_ra(struct readahead_control *ractl, - struct page *page, unsigned long req_count) + struct folio *folio, unsigned long req_count) { /* no read-ahead */ if (!ractl->ra->ra_pages) @@ -590,10 +590,10 @@ void page_cache_async_ra(struct readahead_control *ractl, /* * Same bit is used for PG_readahead and PG_reclaim. */ - if (PageWriteback(page)) + if (folio_test_writeback(folio)) return; - ClearPageReadahead(page); + folio_clear_readahead(folio); /* * Defer asynchronous read-ahead on IO congestion.