From nobody Tue Dec 2 02:17:29 2025
Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com
[45.249.212.56])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F27D303CA1;
Fri, 21 Nov 2025 09:16:53 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
arc=none smtp.client-ip=45.249.212.56
ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1763716623; cv=none;
b=urenZVuMNh3jo/TICX7hV/UpdQjyf9+/EdkBnOzDswh+WNIHUnaCp4++rAfFoh++xdACVq11n0udY1X4DRkSbXhse7QNS1rA9VZBxwzNJf23OlXoIn0MmiA99V0rjhBN8j7lBaTqfNMQyJjp3ir2h+kpT8HJdYNDkQUsj2WcP40=
ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1763716623; c=relaxed/simple;
bh=aF+DbgPYapqeQ+9Sv3+u8mH464IRHeCbCP54ohxIjj0=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version;
b=AWhp7PiELtNVHiwQR1LJUUmEmsUAKhu/vws0DvdOiocqul64digC/yA9FWgflOJJYDU8bu8dW7G15sSI9kS2Cx3NefKSjvVlVkXNq7sdow5HsUqeCQOT6Om7MJWrI7jqjOBp+mgLV45lV6ojlQV2uq54/8KT0MUeNLsIt0mJg6o=
ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none (p=none dis=none) header.from=huaweicloud.com;
spf=none smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56
Authentication-Results: smtp.subspace.kernel.org;
dmarc=none (p=none dis=none) header.from=huaweicloud.com
Authentication-Results: smtp.subspace.kernel.org;
spf=none smtp.mailfrom=huaweicloud.com
Received: from mail.maildlp.com (unknown [172.19.163.235])
by dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4dCV2P2X08zKHMwX;
Fri, 21 Nov 2025 17:16:13 +0800 (CST)
Received: from mail02.huawei.com (unknown [10.116.40.75])
by mail.maildlp.com (Postfix) with ESMTP id 4F5921A0FC0;
Fri, 21 Nov 2025 17:16:44 +0800 (CST)
Received: from huaweicloud.com (unknown [10.50.87.129])
by APP2 (Coremail) with SMTP id Syh0CgBHpXv4LSBpaLMDBg--.2072S28;
Fri, 21 Nov 2025 17:16:44 +0800 (CST)
From: libaokun@huaweicloud.com
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu,
adilger.kernel@dilger.ca,
jack@suse.cz,
linux-kernel@vger.kernel.org,
kernel@pankajraghav.com,
mcgrof@kernel.org,
ebiggers@kernel.org,
willy@infradead.org,
yi.zhang@huawei.com,
yangerkun@huawei.com,
chengzhihao1@huawei.com,
libaokun1@huawei.com,
libaokun@huaweicloud.com,
Pankaj Raghav
Subject: [PATCH v4 24/24] ext4: enable block size larger than page size
Date: Fri, 21 Nov 2025 17:06:54 +0800
Message-Id: <20251121090654.631996-25-libaokun@huaweicloud.com>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20251121090654.631996-1-libaokun@huaweicloud.com>
References: <20251121090654.631996-1-libaokun@huaweicloud.com>
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id:
List-Subscribe:
List-Unsubscribe:
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-CM-TRANSID: Syh0CgBHpXv4LSBpaLMDBg--.2072S28
X-Coremail-Antispam: 1UD129KBjvJXoWxAr4fAryUXrWUtF1DZFWUurg_yoW5WrWxp3
WrGFy8Ar15WFyUua9rWFsF9as3Gw1v9FyUXr90gw1UZFZrX34xKrn7tFy5XFyjqrZ3uFWf
XF1vyryayr43uaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
9KBjDU0xBIdaVrnRJUUUQa14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0
rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI
kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2
z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F
4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq
3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7
IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Gr1j6F4UJwAm72CE4IkC6x0Yz7v_Jr0_
Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8c
xan2IY04v7M4kE6xkIj40Ew7xC0wCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxG
rwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4
vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IY
x2IY67AKxVW5JVW7JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJwCI42IY6xAIw2
0EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x02
67AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUdsqAUUUUU=
X-CM-SenderInfo: 5olet0hnxqqx5xdzvxpfor3voofrz/1tbiAQATBWkf35kfHAAAsk
Content-Type: text/plain; charset="utf-8"
From: Baokun Li
Since block device (See commit 3c20917120ce ("block/bdev: enable large
folio support for large logical block sizes")) and page cache (See commit
ab95d23bab220ef8 ("filemap: allocate mapping_min_order folios in the page
cache")) has the ability to have a minimum order when allocating folio,
and ext4 has supported large folio in commit 7ac67301e82f ("ext4: enable
large folio for regular file"), now add support for block_size > PAGE_SIZE
in ext4.
set_blocksize() -> bdev_validate_blocksize() already validates the block
size, so ext4_load_super() does not need to perform additional checks.
Here we only need to add the FS_LBS bit to fs_flags.
In addition, block sizes larger than the page size are currently supported
only when CONFIG_TRANSPARENT_HUGEPAGE is enabled. To make this explicit,
a blocksize_gt_pagesize entry has been added under /sys/fs/ext4/feature/,
indicating whether bs > ps is supported. This allows mke2fs to check the
interface and determine whether a warning should be issued when formatting
a filesystem with block size larger than the page size.
Suggested-by: Theodore Ts'o
Signed-off-by: Baokun Li
Reviewed-by: Zhang Yi
Reviewed-by: Jan Kara
Reviewed-by: Pankaj Raghav
---
fs/ext4/super.c | 3 ++-
fs/ext4/sysfs.c | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3d03a6eb0ea0..87205660c5d0 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -7453,7 +7453,8 @@ static struct file_system_type ext4_fs_type =3D {
.init_fs_context =3D ext4_init_fs_context,
.parameters =3D ext4_param_specs,
.kill_sb =3D ext4_kill_sb,
- .fs_flags =3D FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME,
+ .fs_flags =3D FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME |
+ FS_LBS,
};
MODULE_ALIAS_FS("ext4");
=20
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index 987bd00f916a..0018e09b867e 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -332,6 +332,9 @@ EXT4_ATTR_FEATURE(fast_commit);
#if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
EXT4_ATTR_FEATURE(encrypted_casefold);
#endif
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+EXT4_ATTR_FEATURE(blocksize_gt_pagesize);
+#endif
=20
static struct attribute *ext4_feat_attrs[] =3D {
ATTR_LIST(lazy_itable_init),
@@ -351,6 +354,9 @@ static struct attribute *ext4_feat_attrs[] =3D {
ATTR_LIST(fast_commit),
#if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
ATTR_LIST(encrypted_casefold),
+#endif
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+ ATTR_LIST(blocksize_gt_pagesize),
#endif
NULL,
};
--=20
2.46.1