Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4858712rdb; Fri, 15 Sep 2023 14:49:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHr0+7dUvGcztZGeuFgAyIC90n4qVdkFY66BYHXw+//c2dt90f4iARzHuMZJf+hTrs1+rbk X-Received: by 2002:a05:6a00:24ca:b0:68e:2f6e:b4c0 with SMTP id d10-20020a056a0024ca00b0068e2f6eb4c0mr3624970pfv.28.1694814571944; Fri, 15 Sep 2023 14:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694814571; cv=none; d=google.com; s=arc-20160816; b=dGTO1FfJ1A0MeMUIDDnXre88GJiEw7Mihce6ep8jC8zVX7NzcLXuL9LG+brG6//RG6 3Qxb38n9bNcYiQhX1WycXZO+XjqwGdumYY1cr+veaydkcYIriMUnx6fOgtwoXaPQCBxK uNMYJKceE3b99GRVydvQ93yT1vS1iBAC8T3S1MvWnpbO2oocUQF4U1ofr5ELTEIWP0rg VALiMX9E7vMHf2pePOQq4xFPSGqjber83oVGyzvvXEGB9M/9pbIoN4y5/cYgzTalZZn6 EK8H3KON4gvj3FbtD7c89qBw1IeI3DMVppIFJKxU5yTjosdlsbvU0LHtncs87oQ2eODV NQOg== 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=rdyOm0E20W1O08Haq+wboPt6O9fnOeXgM7VNGHdT/wc=; fh=kl+S4GAUWD1kOeoqBopscteh2mu3DZslcHc01dOJ6TI=; b=T/C5BKZVkS510v4E16qVq+g8r2hmtqtXgzkuTVglChqSygM+fa7TPivYuiJzvKtiyD 8uVhKAq8XluvyLSL8mmOykXRDjAwjYVBMUJlf+uGDMxnbljnJFKdG0cqEj5XTBde0XJz ByiwRe3JZkss596NCItLH0mN+QIKTUlPXoekh6jHCkZ6X3l91V6TEhyLjcfVc6WaqD3Y ZAYOKtM3DkKc3BftJP+y2x4c1DLyG4ebm7jGF19FwPyMXlb+y/HdVJdOgHh1DgF7Ucvm HjSRV8xG5JVsXBudlqp7TdD+8YjiOQ1FifQAr7KaS1+siLqqBtJOYjRBTza/SDieLr05 l51Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=YWBaYLR8; 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 Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id eg14-20020a056a00800e00b0068fb8fa1e71si3826156pfb.207.2023.09.15.14.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 14:49:31 -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=YWBaYLR8; 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 45DD483D9904; Fri, 15 Sep 2023 11:45:03 -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 S236948AbjIOSoM (ORCPT + 99 others); Fri, 15 Sep 2023 14:44:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236842AbjIOSni (ORCPT ); Fri, 15 Sep 2023 14:43:38 -0400 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050:0:465::202]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93EE6449D; Fri, 15 Sep 2023 11:40:44 -0700 (PDT) Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (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-202.mailbox.org (Postfix) with ESMTPS id 4RnNK84kWKz9sWQ; Fri, 15 Sep 2023 20:39:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1694803196; 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=rdyOm0E20W1O08Haq+wboPt6O9fnOeXgM7VNGHdT/wc=; b=YWBaYLR8wP7FiydPN5L35PApcVVJVdWdr9JQ0wve5greLck+YNw4kh4nrPZG0I3Irb8ki0 iuokOs97BSQFNTgm6YhdORbefrutGfT1KELpkS/3XMgdCJ9oOH4CtnvKt/LPo0PALntzFv p3aHYP5rCYGypOCX8eQG6C8LNjayrhZbhVYUtmATnzcj1I2hW2uQpwW6y/BQVis0Zw0/VG 5DwtrDMNHLI60IzV77LR+S96bZ65EDdStUam1CBD+ng7P3QZexi7+Gw76NWeAcNZn30u4d ZF4HNoSpiJ8j4mP9R3KSBmGwbUH3gqxJZAlgZODdsgOKSUDIhWjurPKl2hsTaw== 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 23/23] xfs: set minimum order folio for page cache based on blocksize Date: Fri, 15 Sep 2023 20:38:48 +0200 Message-Id: <20230915183848.1018717-24-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: 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:45:03 -0700 (PDT) From: Pankaj Raghav Enabling a block size > PAGE_SIZE is only possible if we can ensure that the filesystem allocations for the block size is treated atomically and we do this with the min order folio requirement for the inode. This allows the page cache to treat this inode atomically even if on the block layer we may treat it separately. For instance, on x86 this enables eventual usage of block size > 4k so long as you use a sector size set of 4k. Signed-off-by: Pankaj Raghav Signed-off-by: Luis Chamberlain --- fs/xfs/xfs_icache.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index aacc7eec2497..81f07503f5ca 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -73,6 +73,7 @@ xfs_inode_alloc( xfs_ino_t ino) { struct xfs_inode *ip; + int min_order = 0; /* * XXX: If this didn't occur in transactions, we could drop GFP_NOFAIL @@ -88,7 +89,8 @@ xfs_inode_alloc( /* VFS doesn't initialise i_mode or i_state! */ VFS_I(ip)->i_mode = 0; VFS_I(ip)->i_state = 0; - mapping_set_large_folios(VFS_I(ip)->i_mapping); + min_order = max(min_order, ilog2(mp->m_sb.sb_blocksize) - PAGE_SHIFT); + mapping_set_folio_orders(VFS_I(ip)->i_mapping, min_order, MAX_PAGECACHE_ORDER); XFS_STATS_INC(mp, vn_active); ASSERT(atomic_read(&ip->i_pincount) == 0); @@ -313,6 +315,7 @@ xfs_reinit_inode( dev_t dev = inode->i_rdev; kuid_t uid = inode->i_uid; kgid_t gid = inode->i_gid; + int min_order = 0; error = inode_init_always(mp->m_super, inode); @@ -323,7 +326,8 @@ xfs_reinit_inode( inode->i_rdev = dev; inode->i_uid = uid; inode->i_gid = gid; - mapping_set_large_folios(inode->i_mapping); + min_order = max(min_order, ilog2(mp->m_sb.sb_blocksize) - PAGE_SHIFT); + mapping_set_folio_orders(inode->i_mapping, min_order, MAX_PAGECACHE_ORDER); return error; } -- 2.40.1