[RFC,08/23] filemap: align the index to mapping_min_order in filemap_get_folios_tag()
Message ID | 20230915183848.1018717-9-kernel@pankajraghav.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1281211vqi; Fri, 15 Sep 2023 12:46:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsSQ82XnCXGQQCgRg9cHxEmHWFLLAZbWwZK95Ik+6sSFQd3Y2MIuSuk+3ZNjmXcYxfzhov X-Received: by 2002:a05:6a20:4285:b0:14c:f16a:2b78 with SMTP id o5-20020a056a20428500b0014cf16a2b78mr3482924pzj.45.1694807183489; Fri, 15 Sep 2023 12:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694807183; cv=none; d=google.com; s=arc-20160816; b=PsDPMvJYAIX66vhFmOxYDtFFxSGus3i/aKXZekxeNMvkztemFt3G7Psd0Z4Rzs2Jhn xERgf6hm5JGKZZn0Bj63C9tHBuCjCV6GVmsltvG1zB+NwkR/AVK7B/nJyTgidDsJ78mo M5+M8xRlCwzgS/nTse2oIlqCzAt3zZsTYD6kDvuko+JaQviL7+JEoSkEpTp8FGzDHLFA utPjbOYvYGZIdPXUGLrF4Sb/GjnsdP+6wjjiNQd0KvM1wZO8rdv8sHx85p6A/sEtCErh XIsm89JVLH8PrRCtnT0UhrV+G6R7h5/u3p8VhaXEyK7+EaJtlI0vilbBlPQP3Q9yS4fA LfiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qYagWwQkQyBo9FUt+Wer66h9atojNQ2DWonnQYgzdlw=; fh=kl+S4GAUWD1kOeoqBopscteh2mu3DZslcHc01dOJ6TI=; b=08Ppdo86smnlPT6kCUJMmTCwUwAbATfqmH4cBXb8CBIExNu/2b0DneeTq7jQp9COFY F0SrPgBaYULOiUFmDvJ9WI9yW2uZXvlw8sQfnRwbk5NDDrlh6kCKIznQSDXinbpy5VHg 0UKNm0K+ru5rE6uz5jLY8FBlHDd/2vP/zXo/i8LrD80LsPBaaUGegeanvXpW8bfRGxtt HjnUKIdxkHYWxg/N36Nn89IWfUqygzldwADDB2V/sXTxLhvehvJle5YJ4NFxj/fiyfzv Uyc7ZWPf2wsKn7uJsiM4EF7l4uD3cnEjNKo+Gz9Y8Inj5uliQJchgsjBU2xXaGq8OvmC UZ6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=sLkequQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id z11-20020a6552cb000000b005774452aa3dsi3617826pgp.497.2023.09.15.12.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 12:46:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=sLkequQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id E8F4D808BE43; Fri, 15 Sep 2023 11:41:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236789AbjIOSka (ORCPT <rfc822;ruipengqi7@gmail.com> + 30 others); Fri, 15 Sep 2023 14:40:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236979AbjIOSkE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 15 Sep 2023 14:40:04 -0400 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050:0:465::201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C863F4C06; Fri, 15 Sep 2023 11:39:20 -0700 (PDT) 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 <kernel@pankajraghav.com> 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 15 Sep 2023 11:41:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777134137211670687 X-GMAIL-MSGID: 1777134137211670687 |
Series |
Enable block size > page size in XFS
|
|
Commit Message
Pankaj Raghav (Samsung)
Sept. 15, 2023, 6:38 p.m. UTC
From: Luis Chamberlain <mcgrof@kernel.org> 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 <mcgrof@kernel.org> --- mm/filemap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Comments
On Fri, Sep 15, 2023 at 08:38:33PM +0200, Pankaj Raghav wrote: > From: Luis Chamberlain <mcgrof@kernel.org> > > Align the index to the mapping_min_order number of pages while setting > the XA_STATE in filemap_get_folios_tag(). ... because? It should already search backwards in the page cache, otherwise calling sync_file_range() would skip the start if it landed in a tail page of a folio.
On Fri, Sep 15, 2023 at 08:50:59PM +0100, Matthew Wilcox wrote: > On Fri, Sep 15, 2023 at 08:38:33PM +0200, Pankaj Raghav wrote: > > From: Luis Chamberlain <mcgrof@kernel.org> > > > > Align the index to the mapping_min_order number of pages while setting > > the XA_STATE in filemap_get_folios_tag(). > > ... because? It should already search backwards in the page cache, > otherwise calling sync_file_range() would skip the start if it landed > in a tail page of a folio. Thanks! Will drop and verify! Luis
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();