From mboxrd@z Thu Jan 1 00:00:00 1970 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,URIBL_BLOCKED,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 7B265C07E99 for ; Mon, 12 Jul 2021 04:19:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1B82B61130 for ; Mon, 12 Jul 2021 04:19:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B82B61130 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 3EBD06B0011; Mon, 12 Jul 2021 00:19:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 39BA86B0081; Mon, 12 Jul 2021 00:19:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 264316B008C; Mon, 12 Jul 2021 00:19:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0174.hostedemail.com [216.40.44.174]) by kanga.kvack.org (Postfix) with ESMTP id 048C16B0011 for ; Mon, 12 Jul 2021 00:19:58 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 25ACF824805A for ; Mon, 12 Jul 2021 04:19:58 +0000 (UTC) X-FDA: 78352632876.27.7F47AF9 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf05.hostedemail.com (Postfix) with ESMTP id DDD6E5014AEA for ; Mon, 12 Jul 2021 04:19:57 +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=hXpEnpiS1ePBTEYU3pwBmvZxz5PJcinCq7TWGdPw/Os=; b=mtuy4EfNZowSnAmVeXFnTen8WP ZN0mBLm9i5sKYJKKtymijO4ypF7qA9JwSyrG3kUaQdJoNsQQbgEHLQH9WAubS/hCEjWQ7apC9c1Cs lP9SoFJ3XneIFSG78I0y184SihwC+dXYySbytuiXH+CdUlDXmk8uOD7NCVyv53XP/oBjDm3fUHWs5 rRdNYWSHgO1px2YqVDriEiqzT3WQicsC/Lu5UfbmvJHsB3WW3zHSGxenYyS4/vefoUX3e83+HtTQs wHPXs8pha2SKkKl70XeNi4jn0bz5nbqhAyQ00PJVOdvl4IZkFAomGj5QTjUxd5g/fDmb5barFSMGn 6/uCaW/Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2nPB-00GrrW-CH; Mon, 12 Jul 2021 04:19:11 +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 v13 136/137] mm/readahead: Convert page_cache_async_ra() to take a folio Date: Mon, 12 Jul 2021 04:07:00 +0100 Message-Id: <20210712030701.4000097-137-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712030701.4000097-1-willy@infradead.org> References: <20210712030701.4000097-1-willy@infradead.org> MIME-Version: 1.0 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=mtuy4EfN; 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-Stat-Signature: xnwf6sbi6tm5j7w14a8yru7yhdjdhz15 X-Rspamd-Queue-Id: DDD6E5014AEA X-Rspamd-Server: rspam01 X-HE-Tag: 1626063597-931500 Content-Transfer-Encoding: quoted-printable 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 lets us pass the folio in directly from filemap_readahead(), but its primary reason is to enable us to pass a folio to ondemand_readahead() in the next patch. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 4 ++-- mm/filemap.c | 5 +++-- mm/readahead.c | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 71844b55d0a8..51784f8b9b32 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -955,7 +955,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_co= unt); -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); @@ -1002,7 +1002,7 @@ void page_cache_async_readahead(struct address_spac= e *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); } =20 static inline struct folio *__readahead_folio(struct readahead_control *= ractl) diff --git a/mm/filemap.c b/mm/filemap.c index 57dd01c5060c..2fda11f583a5 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2419,10 +2419,11 @@ static int filemap_readahead(struct kiocb *iocb, = struct file *file, struct address_space *mapping, struct folio *folio, pgoff_t last_index) { + DEFINE_READAHEAD(ractl, file, &file->f_ra, mapping, folio->index); + if (iocb->ki_flags & IOCB_NOIO) return -EAGAIN; - page_cache_async_readahead(mapping, &file->f_ra, file, &folio->page, - folio->index, last_index - folio->index); + page_cache_async_ra(&ractl, folio, last_index - folio->index); return 0; } =20 diff --git a/mm/readahead.c b/mm/readahead.c index d589f147f4c2..30115a21e304 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -580,7 +580,7 @@ void page_cache_sync_ra(struct readahead_control *rac= tl, EXPORT_SYMBOL_GPL(page_cache_sync_ra); =20 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) @@ -589,10 +589,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_writeback(folio)) return; =20 - ClearPageReadahead(page); + folio_clear_readahead_flag(folio); =20 /* * Defer asynchronous read-ahead on IO congestion. --=20 2.30.2