From patchwork Fri Sep 15 18:38:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13387469 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 9487BEED61A for ; Fri, 15 Sep 2023 18:39:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 691586B03BD; Fri, 15 Sep 2023 14:39:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 64D466B03BE; Fri, 15 Sep 2023 14:39:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DFCE6B03BF; Fri, 15 Sep 2023 14:39:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3E2096B03BD for ; Fri, 15 Sep 2023 14:39:19 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0340C1CA77C for ; Fri, 15 Sep 2023 18:39:18 +0000 (UTC) X-FDA: 81239694438.15.134A61A Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf27.hostedemail.com (Postfix) with ESMTP id 570174002A for ; Fri, 15 Sep 2023 18:39:17 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=sLkequQ3; spf=pass (imf27.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694803157; 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=qYagWwQkQyBo9FUt+Wer66h9atojNQ2DWonnQYgzdlw=; b=yHXMM40rJFxU/OSnWvYrlhMSW+HIEqU5lKA8IYW+JrKIW8Z5A62Sa7HKXV2ZONwAn6JicV 5WF/2XENLlgjA37SorZSElDDQODvQprvdMmqRzGq7GXTkgnww/JAcpcoCaPQm4sLFCVYL1 bgZFaQeMgDWlvNs9zFm7Sts1i3oEeck= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694803157; a=rsa-sha256; cv=none; b=KRkwtBYgtJPhEEyM6ob+Avx/CQhWMYzqhODylw+DI03s6Arzh0QkEJZhAvMrE69C4DI4n1 tiave1iMh8FMBCbnRy1HSr4i1LvRcQiQhcxyrUZJq2IcXJx3Ibo3IxyjXLgSINx23rUtNJ HW8vteGoRyzQRfVRdi95h2FNopPqvpQ= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=sLkequQ3; spf=pass (imf27.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4RnNJL12VYz9sTm; Fri, 15 Sep 2023 20:39:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1694803154; 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=qYagWwQkQyBo9FUt+Wer66h9atojNQ2DWonnQYgzdlw=; b=sLkequQ37CkU3k8W1DxxgB42DpoCWPVkiye6O36mnozEtbvveaSpVg02AQr9gRNrsG1StT zaL/G92Pk3Q9LxMD3dVHNbwZKUF2uE0xvuy7ixhERejXQHjckMQRVs4nVmKTcZ8B4ZlwxF dilFyBmIzK3geH/C55u1tMzeAId6PQM20aaVRonwgd4u+BGaOLBKOVd7hyimLCr/FrViWj YBvOAyGNd9SQBuLQuz8bCS/+MMijxud/FLCWs8ijotAjn63u2NB1NyM8wO0y+syInk6R+Q VvQVj3aV97v3/+RLzo4tjrdpk9/BPKcdYe+8EcQcR29kNlkW4twTvSq1m+u2PQ== From: Pankaj Raghav To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: p.raghav@samsung.com, david@fromorbit.com, da.gomez@samsung.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, willy@infradead.org, djwong@kernel.org, linux-mm@kvack.org, chandan.babu@oracle.com, mcgrof@kernel.org, gost.dev@samsung.com Subject: [RFC 08/23] filemap: align the index to mapping_min_order in filemap_get_folios_tag() Date: Fri, 15 Sep 2023 20:38:33 +0200 Message-Id: <20230915183848.1018717-9-kernel@pankajraghav.com> In-Reply-To: <20230915183848.1018717-1-kernel@pankajraghav.com> References: <20230915183848.1018717-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Stat-Signature: xwoy8a3jo5zh9oqpifjzud8mxapzsphe X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 570174002A X-Rspam-User: X-HE-Tag: 1694803157-327543 X-HE-Meta: U2FsdGVkX1/Xwgjz15O6l+Qv/3GcFN6nXVZsL/R9lnWC7DojuDxdHgNnM0XJuVLkIRAvLFR8dvrEP6LfYsga/o+E++fJYA1YJZop8Kfezrfhx8Fe9QEYGnCcSynsijC5105XInGBCwUNm4zxP5xfRC+HQnT6MNU0WQGlkProbWWEIXKsU6n/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W8W70G9aNILd1OlRW+++A0gN+P+oHwJ9g3WUTYaj2tXV7PwVmWAGIM+sYM+5LRTUR77iRQp5b5MYcs85YeTO0YmGCU/ndVo4XbAT/cwxY= 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: From: Luis Chamberlain Align the index to the mapping_min_order number of pages while setting the XA_STATE in filemap_get_folios_tag(). Signed-off-by: Luis Chamberlain --- mm/filemap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index 15bc810bfc89..21e1341526ab 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2280,7 +2280,9 @@ EXPORT_SYMBOL(filemap_get_folios_contig); unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start, pgoff_t end, xa_mark_t tag, struct folio_batch *fbatch) { - XA_STATE(xas, &mapping->i_pages, *start); + unsigned int min_order = mapping_min_folio_order(mapping); + unsigned int nrpages = 1UL << min_order; + XA_STATE(xas, &mapping->i_pages, round_down(*start, nrpages)); struct folio *folio; rcu_read_lock();