diff --git a/0001-btrfs-progs-mkfs-Enforce-4k-sectorsize-by-default.patch b/0001-btrfs-progs-mkfs-Enforce-4k-sectorsize-by-default.patch new file mode 100644 index 0000000..df26fbb --- /dev/null +++ b/0001-btrfs-progs-mkfs-Enforce-4k-sectorsize-by-default.patch @@ -0,0 +1,91 @@ +From: Neal Gompa +Subject: [PATCH 1/1] btrfs-progs: mkfs: Enforce 4k sectorsize by default +Date: Wed, 22 Mar 2023 18:17:14 -0400 +Content-Transfer-Encoding: 8bit + +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. + +Signed-off-by: Neal Gompa + +Reviewed-by: Anand Jain +Reviewed-by: Qu Wenruo +Reviewed-by: Josef Bacik + +--- + Documentation/Subpage.rst | 15 ++++++++------- + Documentation/mkfs.btrfs.rst | 13 +++++++++---- + mkfs/main.c | 2 +- + 3 files changed, 18 insertions(+), 12 deletions(-) + +diff --git a/Documentation/Subpage.rst b/Documentation/Subpage.rst +index 21a495d5..39ef7d6d 100644 +--- a/Documentation/Subpage.rst ++++ b/Documentation/Subpage.rst +@@ -9,17 +9,18 @@ to the exactly same size of the block and page. On x86_64 this is typically + pages, like 64KiB on 64bit ARM or PowerPC. This means filesystems created + with 64KiB sector size cannot be mounted on a system with 4KiB page size. + +-While with subpage support, systems with 64KiB page size can create (still needs +-"-s 4k" option for mkfs.btrfs) and mount filesystems with 4KiB sectorsize, +-allowing us to push 4KiB sectorsize as default sectorsize for all platforms in the +-near future. ++Since v6.3, filesystems are created with a 4KiB sectorsize by default, ++though it remains possible to create filesystems with other page sizes ++(such as 64KiB with the "-s 64k" option for mkfs.btrfs). This ensures that ++new filesystems are compatible across other architecture variants using ++larger page sizes. + + Requirements, limitations + ------------------------- + +-The initial subpage support has been added in v5.15, although it's still +-considered as experimental at the time of writing (v5.18), most features are +-already working without problems. ++The initial subpage support has been added in v5.15. Most features are ++already working without problems. Subpage support is used by default ++for systems with a non-4KiB page size since v6.3. + + End users can mount filesystems with 4KiB sectorsize and do their usual + workload, while should not notice any obvious change, as long as the initial +diff --git a/Documentation/mkfs.btrfs.rst b/Documentation/mkfs.btrfs.rst +index ba7227b3..16abf0ca 100644 +--- a/Documentation/mkfs.btrfs.rst ++++ b/Documentation/mkfs.btrfs.rst +@@ -116,10 +116,15 @@ OPTIONS + -s|--sectorsize + Specify the sectorsize, the minimum data block allocation unit. + +- The default value is the page size and is autodetected. If the sectorsize +- differs from the page size, the created filesystem may not be mountable by the +- running kernel. Therefore it is not recommended to use this option unless you +- are going to mount it on a system with the appropriate page size. ++ By default, the value is 4KiB, but it can be manually set to match the ++ system page size. However, if the sector size is different from the page ++ size, the resulting filesystem may not be mountable by the current ++ kernel, apart from the default 4KiB. Hence, using this option is not ++ advised unless you intend to mount it on a system with the suitable ++ page size. ++ ++ .. note:: ++ Versions prior to 6.3 set the sectorsize matching to the page size. + + -L|--label + Specify a label for the filesystem. The *string* should be less than 256 +diff --git a/mkfs/main.c b/mkfs/main.c +index f5e34cbd..5e1834d7 100644 +--- a/mkfs/main.c ++++ b/mkfs/main.c +@@ -1207,7 +1207,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) + } + + if (!sectorsize) +- sectorsize = (u32)sysconf(_SC_PAGESIZE); ++ sectorsize = (u32)SZ_4K; + if (btrfs_check_sectorsize(sectorsize)) + goto error; + +-- +2.39.2 + diff --git a/0002-btrfs-progs-mkfs-doc-Drop-version-change-for-4k-sect.patch b/0002-btrfs-progs-mkfs-doc-Drop-version-change-for-4k-sect.patch new file mode 100644 index 0000000..6be30db --- /dev/null +++ b/0002-btrfs-progs-mkfs-doc-Drop-version-change-for-4k-sect.patch @@ -0,0 +1,52 @@ +From 56ea5a3eba4f2048d3e6297a7ab7eb5ef19e2177 Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Tue, 21 Mar 2023 15:40:15 -0400 +Subject: [PATCH 2/2] btrfs-progs: mkfs: doc: Drop version change for 4k + sectorsize + +This is not yet upstream so we don't know what version this change +has landed in. +--- + Documentation/Subpage.rst | 4 ++-- + Documentation/mkfs.btrfs.rst | 3 --- + 2 files changed, 2 insertions(+), 5 deletions(-) + +diff --git a/Documentation/Subpage.rst b/Documentation/Subpage.rst +index 39ef7d6d..a128db95 100644 +--- a/Documentation/Subpage.rst ++++ b/Documentation/Subpage.rst +@@ -9,7 +9,7 @@ to the exactly same size of the block and page. On x86_64 this is typically + pages, like 64KiB on 64bit ARM or PowerPC. This means filesystems created + with 64KiB sector size cannot be mounted on a system with 4KiB page size. + +-Since v6.3, filesystems are created with a 4KiB sectorsize by default, ++Filesystems are created with a 4KiB sectorsize by default, + though it remains possible to create filesystems with other page sizes + (such as 64KiB with the "-s 64k" option for mkfs.btrfs). This ensures that + new filesystems are compatible across other architecture variants using +@@ -20,7 +20,7 @@ Requirements, limitations + + The initial subpage support has been added in v5.15. Most features are + already working without problems. Subpage support is used by default +-for systems with a non-4KiB page size since v6.3. ++for systems with a non-4KiB page size. + + End users can mount filesystems with 4KiB sectorsize and do their usual + workload, while should not notice any obvious change, as long as the initial +diff --git a/Documentation/mkfs.btrfs.rst b/Documentation/mkfs.btrfs.rst +index 50d9921a..0f6056a4 100644 +--- a/Documentation/mkfs.btrfs.rst ++++ b/Documentation/mkfs.btrfs.rst +@@ -123,9 +123,6 @@ OPTIONS + advised unless you intend to mount it on a system with the suitable + page size. + +- .. note:: +- Versions prior to 6.3 set the sectorsize matching to the page size. +- + -L|--label + Specify a label for the filesystem. The *string* should be less than 256 + bytes and must not contain newline characters. +-- +2.39.2 + diff --git a/btrfs-progs.spec b/btrfs-progs.spec index 6535f0a..ad92628 100644 --- a/btrfs-progs.spec +++ b/btrfs-progs.spec @@ -3,7 +3,7 @@ Name: btrfs-progs Version: 6.2.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Userspace programs for btrfs License: GPL-2.0-only @@ -12,6 +12,13 @@ Source0: https://www.kernel.org/pub/linux/kernel/people/kdave/%{name}/%{n Source1: https://www.kernel.org/pub/linux/kernel/people/kdave/%{name}/%{name}-v%{version_no_tilde}.tar.sign Source2: gpgkey-F2B41200C54EFB30380C1756C565D5F9D76D583B.gpg +# Upstreamable changes +## From: https://lore.kernel.org/linux-btrfs/20230322221714.2702819-1-neal@gompa.dev/T/#t +Patch0101: 0001-btrfs-progs-mkfs-Enforce-4k-sectorsize-by-default.patch +## Fedora specific doc change stacked on top +Patch0102: 0002-btrfs-progs-mkfs-doc-Drop-version-change-for-4k-sect.patch + + BuildRequires: gnupg2 BuildRequires: gcc, autoconf, automake, make BuildRequires: git-core @@ -147,6 +154,9 @@ popd %{python3_sitearch}/btrfsutil-*.egg-info/ %changelog +* Wed Mar 22 2023 Neal Gompa - 6.2.1-2 +- Add patch to force default sectorsize to 4k + * Mon Mar 06 2023 Neal Gompa - 6.2.1-1 - Update to 6.2.1