|
|
4ecb47 |
From 4d8199f0e3d30be69ebd10820d5402ec8d326e38 Mon Sep 17 00:00:00 2001
|
|
|
4ecb47 |
From: Neal Gompa <neal@gompa.dev>
|
|
|
4ecb47 |
Date: Wed, 22 Mar 2023 18:17:14 -0400
|
|
|
4ecb47 |
Subject: [PATCH 1/1] btrfs-progs: mkfs: Enforce 4k sectorsize by default
|
|
|
4ecb47 |
|
|
|
4ecb47 |
We have had working subpage support in Btrfs for many cycles now.
|
|
|
4ecb47 |
Generally, we do not want people creating filesystems by default
|
|
|
4ecb47 |
with non-4k sectorsizes since it creates portability problems.
|
|
|
4ecb47 |
|
|
|
4ecb47 |
Signed-off-by: Neal Gompa <neal@gompa.dev>
|
|
|
4ecb47 |
|
|
|
4ecb47 |
Reviewed-by: Anand Jain <anand.jain@oracle.com>
|
|
|
4ecb47 |
Reviewed-by: Qu Wenruo <wqu@suse.com>
|
|
|
4ecb47 |
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
|
|
|
4ecb47 |
---
|
|
|
4ecb47 |
Documentation/Subpage.rst | 17 +++++++++--------
|
|
|
4ecb47 |
Documentation/mkfs.btrfs.rst | 13 +++++++++----
|
|
|
4ecb47 |
mkfs/main.c | 2 +-
|
|
|
4ecb47 |
3 files changed, 19 insertions(+), 13 deletions(-)
|
|
|
4ecb47 |
|
|
|
4ecb47 |
diff --git a/Documentation/Subpage.rst b/Documentation/Subpage.rst
|
|
|
4ecb47 |
index c762b6a3..4bcfc6cf 100644
|
|
|
4ecb47 |
--- a/Documentation/Subpage.rst
|
|
|
4ecb47 |
+++ b/Documentation/Subpage.rst
|
|
|
4ecb47 |
@@ -9,18 +9,19 @@ to the exactly same size of the block and page. On x86_64 this is typically
|
|
|
4ecb47 |
pages, like 64KiB on 64bit ARM or PowerPC. This means filesystems created
|
|
|
4ecb47 |
with 64KiB sector size cannot be mounted on a system with 4KiB page size.
|
|
|
4ecb47 |
|
|
|
4ecb47 |
-While with subpage support systems with 64KiB page size can create
|
|
|
4ecb47 |
-and mount filesystems with 4KiB sectorsize. This still needs to use option "-s
|
|
|
4ecb47 |
-4k" option for :command:`mkfs.btrfs`.
|
|
|
4ecb47 |
+Since v6.5, filesystems are created with a 4KiB sectorsize by default,
|
|
|
4ecb47 |
+though it remains possible to create filesystems with other page sizes
|
|
|
4ecb47 |
+(such as 64KiB with the "-s 64k" option for :command:`mkfs.btrfs`). This
|
|
|
4ecb47 |
+ensures that new filesystems are compatible across other architecture
|
|
|
4ecb47 |
+variants using larger page sizes.
|
|
|
4ecb47 |
|
|
|
4ecb47 |
Requirements, limitations
|
|
|
4ecb47 |
-------------------------
|
|
|
4ecb47 |
|
|
|
4ecb47 |
-The initial subpage support has been added in v5.15, although it's still
|
|
|
4ecb47 |
-considered as experimental, most features are already working without problems.
|
|
|
4ecb47 |
-On a 64KiB page system filesystem with 4KiB sectorsize can be mounted and used
|
|
|
4ecb47 |
-as usual as long as the initial mount succeeds. There are cases a mount will be
|
|
|
4ecb47 |
-rejected when verifying compatible features.
|
|
|
4ecb47 |
+The initial subpage support has been added in v5.15. Most features are
|
|
|
4ecb47 |
+already working without problems. On a 64KiB page system, a filesystem with
|
|
|
4ecb47 |
+4KiB sectorsize can be mounted and used as long as the initial mount succeeds.
|
|
|
4ecb47 |
+Subpage support is used by default for systems with a non-4KiB page size since v6.5.
|
|
|
4ecb47 |
|
|
|
4ecb47 |
Please refer to status page of :ref:`status-subpage-block-size` for
|
|
|
4ecb47 |
compatibility.
|
|
|
4ecb47 |
diff --git a/Documentation/mkfs.btrfs.rst b/Documentation/mkfs.btrfs.rst
|
|
|
4ecb47 |
index 1fca7448..d602fe9c 100644
|
|
|
4ecb47 |
--- a/Documentation/mkfs.btrfs.rst
|
|
|
4ecb47 |
+++ b/Documentation/mkfs.btrfs.rst
|
|
|
4ecb47 |
@@ -122,10 +122,15 @@ OPTIONS
|
|
|
4ecb47 |
-s|--sectorsize <size>
|
|
|
4ecb47 |
Specify the sectorsize, the minimum data block allocation unit.
|
|
|
4ecb47 |
|
|
|
4ecb47 |
- The default value is the page size and is autodetected. If the sectorsize
|
|
|
4ecb47 |
- differs from the page size, the created filesystem may not be mountable by the
|
|
|
4ecb47 |
- running kernel. Therefore it is not recommended to use this option unless you
|
|
|
4ecb47 |
- are going to mount it on a system with the appropriate page size.
|
|
|
4ecb47 |
+ By default, the value is 4KiB, but it can be manually set to match the
|
|
|
4ecb47 |
+ system page size. However, if the sector size is different from the page
|
|
|
4ecb47 |
+ size, the resulting filesystem may not be mountable by the current
|
|
|
4ecb47 |
+ kernel, apart from the default 4KiB. Hence, using this option is not
|
|
|
4ecb47 |
+ advised unless you intend to mount it on a system with the suitable
|
|
|
4ecb47 |
+ page size.
|
|
|
4ecb47 |
+
|
|
|
4ecb47 |
+ .. note::
|
|
|
4ecb47 |
+ Versions prior to 6.4 set the sectorsize matching to the page size.
|
|
|
4ecb47 |
|
|
|
4ecb47 |
-L|--label <string>
|
|
|
4ecb47 |
Specify a label for the filesystem. The *string* should be less than 256
|
|
|
4ecb47 |
diff --git a/mkfs/main.c b/mkfs/main.c
|
|
|
4ecb47 |
index 1c5d668e..bd2e4350 100644
|
|
|
4ecb47 |
--- a/mkfs/main.c
|
|
|
4ecb47 |
+++ b/mkfs/main.c
|
|
|
4ecb47 |
@@ -1204,7 +1204,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
|
|
|
4ecb47 |
}
|
|
|
4ecb47 |
|
|
|
4ecb47 |
if (!sectorsize)
|
|
|
4ecb47 |
- sectorsize = (u32)sysconf(_SC_PAGESIZE);
|
|
|
4ecb47 |
+ sectorsize = (u32)SZ_4K;
|
|
|
4ecb47 |
if (btrfs_check_sectorsize(sectorsize))
|
|
|
4ecb47 |
goto error;
|
|
|
4ecb47 |
|
|
|
4ecb47 |
--
|
|
|
4ecb47 |
2.41.0
|
|
|
4ecb47 |
|