From patchwork Mon Feb 26 09:49:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571763 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 09F96C48BF6 for ; Mon, 26 Feb 2024 09:50:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EBB994001F; Mon, 26 Feb 2024 04:50:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 89A8D940014; Mon, 26 Feb 2024 04:50:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7147994001F; Mon, 26 Feb 2024 04:50:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5E5BA940014 for ; Mon, 26 Feb 2024 04:50:07 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 37DB880788 for ; Mon, 26 Feb 2024 09:50:07 +0000 (UTC) X-FDA: 81833484054.15.FB5A56E Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by imf04.hostedemail.com (Postfix) with ESMTP id 85A604000E for ; Mon, 26 Feb 2024 09:50:05 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=UvS4naGN; dmarc=none; spf=pass (imf04.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941005; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1njdQFWaR2BtfAMszTyy2iO3Y5kDTGCSewwBty7+2Kw=; b=RNYQ9V4de6uHzHO6yGSrl5waC0YxsDD/fIDx5kyfxTWrYgTRAXM83p6Dap9KUvSqr0sodb UYAgYIGWptqG6zWSnmPqarT7OUtv8BPQbuvhMGxznVvkUFNKaOt2INg7loNOCXXPy9o5ov iwLubk49olxmzLZ5qY7ZoPUmb5Mbrns= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=UvS4naGN; dmarc=none; spf=pass (imf04.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941005; a=rsa-sha256; cv=none; b=OnEHCY/OOdp+VVe+c6w+zh6IBPeb9CY/dYyh5/6hJhvWDS+As1+ZpVIOCjLN3urKLdrGWZ ywmW7DTwrBadhxltku5pZw+8l9Ivv6l49FgstqfyBjFIB12Im+74nQ1gwATADPem7lS35T TfGFAvci5DrW7MDcImvOM19eo1PdYq8= Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4Tjwp22M3Bz9sTN; Mon, 26 Feb 2024 10:50:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708941002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1njdQFWaR2BtfAMszTyy2iO3Y5kDTGCSewwBty7+2Kw=; b=UvS4naGN4B56NJsI1HXSdud2G5jomcFJ6pR8o51SW+VBhDFliKwBLh4YZFda4FACselOUk sr4+d8VOS/b+sN0XHZQ6vaUSG3xl6nmuAanTZxrifjgawftiv6ksfHNzhwGDNJf6w42bDq lmZGaWCeBHrP8LsXhFaYvtWRjZpr6UlNDGjI7mlb47aYk7yS02GDIhAfcwoWIGEpMwbP2y TD3mOqA99RywbbiYZMURMmzzCB8mckCp+XBDQmQZmvggaMnvwZEK0aKR1RuwYYdM4qnyBj WJ8s1ztuAJLE9Fm/QlnPXMTzGrmXUvfuxF5DfPZIOnX717VcvRq0XaL7/vXmgA== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 05/13] readahead: set file_ra_state->ra_pages to be at least mapping_min_order Date: Mon, 26 Feb 2024 10:49:28 +0100 Message-ID: <20240226094936.2677493-6-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 85A604000E X-Stat-Signature: gedjzd5re9gsdm4zef57n465j9gdd9uq X-Rspam-User: X-HE-Tag: 1708941005-672346 X-HE-Meta: U2FsdGVkX18ZCBXIn9+y4l4FYxgkHgVLhJyk1Jh5jf99XmBoQSLKAo96kyBjDa2USQiyGdQLyvubMMLlQQD01YAbxL6OwZjLKPPOHarAtNj93V+oLzrvOhDZozWHyTFf0569Sezjrh4ev+PPjZxEVWv7s+3k6bQxHYymsh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vppTSXWQ1tHRo9/Ut4agAoktkf2b0JswbUzMkZSrzhkIshIBWSp5gUInfLAkIeFtDFXZmr6nkxcw/+x/fwC6q8SQeEMdMZwokaWA7SOYHpkddPTDoNMVAs2fiarAchfs4lgnvdtjPpDkL4xWps1/cZppAHLBdn17aclcbkgel3nxKE4eURQog== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Luis Chamberlain Set the file_ra_state->ra_pages in file_ra_state_init() to be at least mapping_min_order of pages if the bdi->ra_pages is less than that. Signed-off-by: Luis Chamberlain Signed-off-by: Pankaj Raghav --- mm/readahead.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/readahead.c b/mm/readahead.c index 369c70e2be42..8a610b78d94b 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -138,7 +138,11 @@ void file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping) { + unsigned int min_nrpages = mapping_min_folio_nrpages(mapping); + ra->ra_pages = inode_to_bdi(mapping->host)->ra_pages; + if (ra->ra_pages < min_nrpages) + ra->ra_pages = min_nrpages; ra->prev_pos = -1; } EXPORT_SYMBOL_GPL(file_ra_state_init);