Skip to content

Commit e3232c2

Browse files
Conan-Kudokdave
authored andcommitted
btrfs-progs: mkfs: make 4k sectorsize default
We have had working subpage support in Btrfs for many cycles now. Generally, we do not want people creating filesystems by default with non-4k sectorsizes since it creates portability problems. As the subpage has stabilized it seems to be safe to do the switch. This may still affect users that relying on the previous behaviour. Issue: #604 Reviewed-by: Anand Jain <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Reviewed-by: Josef Bacik <[email protected]> Reviewed-by: Eric Curtin <[email protected]> Signed-off-by: Neal Gompa <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent fdf7f35 commit e3232c2

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

Documentation/Subpage.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@ to the exactly same size of the block and page. On x86_64 this is typically
99
pages, like 64KiB on 64bit ARM or PowerPC. This means filesystems created
1010
with 64KiB sector size cannot be mounted on a system with 4KiB page size.
1111

12-
While with subpage support systems with 64KiB page size can create
13-
and mount filesystems with 4KiB sectorsize. This still needs to use option "-s
14-
4k" option for :command:`mkfs.btrfs`.
12+
Since v6.7, filesystems are created with a 4KiB sectorsize by default,
13+
though it remains possible to create filesystems with other page sizes
14+
(such as 64KiB with the "-s 64k" option for :command:`mkfs.btrfs`). This
15+
ensures that new filesystems are compatible across other architecture
16+
variants using larger page sizes.
1517

1618
Requirements, limitations
1719
-------------------------
1820

19-
The initial subpage support has been added in v5.15, although it's still
20-
considered as experimental, most features are already working without problems.
21-
On a 64KiB page system filesystem with 4KiB sectorsize can be mounted and used
22-
as usual as long as the initial mount succeeds. There are cases a mount will be
23-
rejected when verifying compatible features.
21+
The initial subpage support has been added in v5.15. Most features are
22+
already working without problems. On a 64KiB page system, a filesystem with
23+
4KiB sectorsize can be mounted and used as long as the initial mount succeeds.
24+
Subpage support is used by default for systems with a non-4KiB page size since v6.7.
2425

2526
Please refer to status page of :ref:`status-subpage-block-size` for
2627
compatibility.

Documentation/mkfs.btrfs.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,15 @@ OPTIONS
122122
-s|--sectorsize <size>
123123
Specify the sectorsize, the minimum data block allocation unit.
124124

125-
The default value is the page size and is autodetected. If the sectorsize
126-
differs from the page size, the created filesystem may not be mountable by the
127-
running kernel. Therefore it is not recommended to use this option unless you
128-
are going to mount it on a system with the appropriate page size.
125+
By default, the value is 4KiB, but it can be manually set to match the
126+
system page size. However, if the sector size is different from the page
127+
size, the resulting filesystem may not be mountable by the current
128+
kernel, apart from the default 4KiB. Hence, using this option is not
129+
advised unless you intend to mount it on a system with the suitable
130+
page size.
131+
132+
.. note::
133+
Versions prior to 6.7 set the sectorsize matching to the page size.
129134

130135
-L|--label <string>
131136
Specify a label for the filesystem. The *string* should be less than 256

mkfs/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
13841384
}
13851385

13861386
if (!sectorsize)
1387-
sectorsize = (u32)sysconf(_SC_PAGESIZE);
1387+
sectorsize = (u32)SZ_4K;
13881388
if (btrfs_check_sectorsize(sectorsize))
13891389
goto error;
13901390

0 commit comments

Comments
 (0)