linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/1] Enforce 4k sectorize by default for mkfs
@ 2023-03-21 18:06 Neal Gompa
  2023-03-21 18:06 ` [RFC PATCH v2 1/1] btrfs-progs: mkfs: Enforce 4k sectorsize by default Neal Gompa
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Neal Gompa @ 2023-03-21 18:06 UTC (permalink / raw)
  To: Linux BTRFS Development
  Cc: Neal Gompa, Anand Jain, Qu Wenruo, Qu Wenruo, David Sterba,
	Hector Martin, Sven Peter, Davide Cavalca, Jens Axboe,
	Asahi Lina, Asahi Linux

The Fedora Asahi SIG[0] is working on bringing up support for
Apple Silicon Macintosh computers through the Asahi Fedora Remix[1].

Apple Silicon Macs are unusual in that they currently require 16k
page sizes, which means that the current default for mkfs.btrfs(8)
makes a filesystem that is unreadable on x86 PCs and most other ARM
PCs.

Soon, this will be even more of a problem within Apple Silicon Macs
as Asahi Lina is working on 4k support to enable x86 emulation[2]
and since Linux does not support dynamically switching page sizes at
runtime, users will likely regularly switch back and forth depending
on their needs.

Thus, I'd like to see us finally make the switchover to 4k sectorsize
for new filesystems by default, regardless of page size.

The initial test run by Hector Martin[3] at request of Qu Wenruo
looks promising[4], and I hope we can get this to land upstream soon.

This is an update on the initial RFC patch[5], which addresses the
documentation feedback from Anand Jain.

[0]: https://fedoraproject.org/wiki/SIGs/Asahi
[1]: https://asahi-fedora-remix.org/
[2]: https://vt.social/@lina/110060963422545117
[3]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#m11d7939de96c43b3a7cdabc7c568d8bcafc7ca83
[4]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#mf382b78a8122b0cb82147a536c85b6a9098a2895
[5]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#t

Neal Gompa (1):
  btrfs-progs: mkfs: Enforce 4k sectorsize by default

 Documentation/Subpage.rst    | 15 ++++++++-------
 Documentation/mkfs.btrfs.rst | 13 +++++++++----
 mkfs/main.c                  |  2 +-
 3 files changed, 18 insertions(+), 12 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC PATCH v2 1/1] btrfs-progs: mkfs: Enforce 4k sectorsize by default
  2023-03-21 18:06 [RFC PATCH v2 0/1] Enforce 4k sectorize by default for mkfs Neal Gompa
@ 2023-03-21 18:06 ` Neal Gompa
  2023-03-22  2:43   ` Anand Jain
  2023-03-22  2:25 ` [RFC PATCH v2 0/1] Enforce 4k sectorize by default for mkfs Qu Wenruo
  2023-03-22 14:33 ` Josef Bacik
  2 siblings, 1 reply; 6+ messages in thread
From: Neal Gompa @ 2023-03-21 18:06 UTC (permalink / raw)
  To: Linux BTRFS Development
  Cc: Neal Gompa, Anand Jain, Qu Wenruo, Qu Wenruo, David Sterba,
	Hector Martin, Sven Peter, Davide Cavalca, Jens Axboe,
	Asahi Lina, Asahi Linux

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 <neal@gompa.dev>
---
 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 <size>
         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 <string>
         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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH v2 0/1] Enforce 4k sectorize by default for mkfs
  2023-03-21 18:06 [RFC PATCH v2 0/1] Enforce 4k sectorize by default for mkfs Neal Gompa
  2023-03-21 18:06 ` [RFC PATCH v2 1/1] btrfs-progs: mkfs: Enforce 4k sectorsize by default Neal Gompa
@ 2023-03-22  2:25 ` Qu Wenruo
  2023-03-22 14:33 ` Josef Bacik
  2 siblings, 0 replies; 6+ messages in thread
From: Qu Wenruo @ 2023-03-22  2:25 UTC (permalink / raw)
  To: Neal Gompa, Linux BTRFS Development
  Cc: Anand Jain, Qu Wenruo, David Sterba, Hector Martin, Sven Peter,
	Davide Cavalca, Jens Axboe, Asahi Lina, Asahi Linux



On 2023/3/22 02:06, Neal Gompa wrote:
> The Fedora Asahi SIG[0] is working on bringing up support for
> Apple Silicon Macintosh computers through the Asahi Fedora Remix[1].
> 
> Apple Silicon Macs are unusual in that they currently require 16k
> page sizes, which means that the current default for mkfs.btrfs(8)
> makes a filesystem that is unreadable on x86 PCs and most other ARM
> PCs.
> 
> Soon, this will be even more of a problem within Apple Silicon Macs
> as Asahi Lina is working on 4k support to enable x86 emulation[2]
> and since Linux does not support dynamically switching page sizes at
> runtime, users will likely regularly switch back and forth depending
> on their needs.
> 
> Thus, I'd like to see us finally make the switchover to 4k sectorsize
> for new filesystems by default, regardless of page size.
> 
> The initial test run by Hector Martin[3] at request of Qu Wenruo
> looks promising[4], and I hope we can get this to land upstream soon.

Reviewed-by: Qu Wenruo <wqu@suse.com>

And I'm already pulling my aarch64 VM to run subpage tests again, and 
this time with 16K page size, just like the one utilized by Asahi Linux 
project.

The failures reported by Hector is being investigated, and such switch 
in mkfs would bring more feedback from other distros too.
Hopefully we can also remove the experimental warning from kernel soon.

Thanks,
Qu

> 
> This is an update on the initial RFC patch[5], which addresses the
> documentation feedback from Anand Jain.
> 
> [0]: https://fedoraproject.org/wiki/SIGs/Asahi
> [1]: https://asahi-fedora-remix.org/
> [2]: https://vt.social/@lina/110060963422545117
> [3]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#m11d7939de96c43b3a7cdabc7c568d8bcafc7ca83
> [4]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#mf382b78a8122b0cb82147a536c85b6a9098a2895
> [5]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#t
> 
> Neal Gompa (1):
>    btrfs-progs: mkfs: Enforce 4k sectorsize by default
> 
>   Documentation/Subpage.rst    | 15 ++++++++-------
>   Documentation/mkfs.btrfs.rst | 13 +++++++++----
>   mkfs/main.c                  |  2 +-
>   3 files changed, 18 insertions(+), 12 deletions(-)
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH v2 1/1] btrfs-progs: mkfs: Enforce 4k sectorsize by default
  2023-03-21 18:06 ` [RFC PATCH v2 1/1] btrfs-progs: mkfs: Enforce 4k sectorsize by default Neal Gompa
@ 2023-03-22  2:43   ` Anand Jain
  0 siblings, 0 replies; 6+ messages in thread
From: Anand Jain @ 2023-03-22  2:43 UTC (permalink / raw)
  To: Neal Gompa, Linux BTRFS Development
  Cc: Qu Wenruo, Qu Wenruo, David Sterba, Hector Martin, Sven Peter,
	Davide Cavalca, Jens Axboe, Asahi Lina, Asahi Linux


LGTM

Reviewed-by: Anand Jain <anand.jain@oracle.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH v2 0/1] Enforce 4k sectorize by default for mkfs
  2023-03-21 18:06 [RFC PATCH v2 0/1] Enforce 4k sectorize by default for mkfs Neal Gompa
  2023-03-21 18:06 ` [RFC PATCH v2 1/1] btrfs-progs: mkfs: Enforce 4k sectorsize by default Neal Gompa
  2023-03-22  2:25 ` [RFC PATCH v2 0/1] Enforce 4k sectorize by default for mkfs Qu Wenruo
@ 2023-03-22 14:33 ` Josef Bacik
  2023-03-22 17:11   ` Neal Gompa
  2 siblings, 1 reply; 6+ messages in thread
From: Josef Bacik @ 2023-03-22 14:33 UTC (permalink / raw)
  To: Neal Gompa
  Cc: Linux BTRFS Development, Anand Jain, Qu Wenruo, Qu Wenruo,
	David Sterba, Hector Martin, Sven Peter, Davide Cavalca,
	Jens Axboe, Asahi Lina, Asahi Linux

On Tue, Mar 21, 2023 at 02:06:09PM -0400, Neal Gompa wrote:
> The Fedora Asahi SIG[0] is working on bringing up support for
> Apple Silicon Macintosh computers through the Asahi Fedora Remix[1].
> 
> Apple Silicon Macs are unusual in that they currently require 16k
> page sizes, which means that the current default for mkfs.btrfs(8)
> makes a filesystem that is unreadable on x86 PCs and most other ARM
> PCs.
> 
> Soon, this will be even more of a problem within Apple Silicon Macs
> as Asahi Lina is working on 4k support to enable x86 emulation[2]
> and since Linux does not support dynamically switching page sizes at
> runtime, users will likely regularly switch back and forth depending
> on their needs.
> 
> Thus, I'd like to see us finally make the switchover to 4k sectorsize
> for new filesystems by default, regardless of page size.
> 
> The initial test run by Hector Martin[3] at request of Qu Wenruo
> looks promising[4], and I hope we can get this to land upstream soon.
> 
> This is an update on the initial RFC patch[5], which addresses the
> documentation feedback from Anand Jain.
> 
> [0]: https://fedoraproject.org/wiki/SIGs/Asahi
> [1]: https://asahi-fedora-remix.org/
> [2]: https://vt.social/@lina/110060963422545117
> [3]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#m11d7939de96c43b3a7cdabc7c568d8bcafc7ca83
> [4]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#mf382b78a8122b0cb82147a536c85b6a9098a2895
> [5]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#t
> 

This all looks good to me, you can add

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

I've got a mac studio on the way, I'll add this to our CI testing to make sure
we've got good coverage of this code going forward.  Thanks,

Josef

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH v2 0/1] Enforce 4k sectorize by default for mkfs
  2023-03-22 14:33 ` Josef Bacik
@ 2023-03-22 17:11   ` Neal Gompa
  0 siblings, 0 replies; 6+ messages in thread
From: Neal Gompa @ 2023-03-22 17:11 UTC (permalink / raw)
  To: Josef Bacik
  Cc: Linux BTRFS Development, Anand Jain, Qu Wenruo, Qu Wenruo,
	David Sterba, Hector Martin, Sven Peter, Davide Cavalca,
	Jens Axboe, Asahi Lina, Asahi Linux

On Wed, Mar 22, 2023 at 10:33 AM Josef Bacik <josef@toxicpanda.com> wrote:
>
> On Tue, Mar 21, 2023 at 02:06:09PM -0400, Neal Gompa wrote:
> > The Fedora Asahi SIG[0] is working on bringing up support for
> > Apple Silicon Macintosh computers through the Asahi Fedora Remix[1].
> >
> > Apple Silicon Macs are unusual in that they currently require 16k
> > page sizes, which means that the current default for mkfs.btrfs(8)
> > makes a filesystem that is unreadable on x86 PCs and most other ARM
> > PCs.
> >
> > Soon, this will be even more of a problem within Apple Silicon Macs
> > as Asahi Lina is working on 4k support to enable x86 emulation[2]
> > and since Linux does not support dynamically switching page sizes at
> > runtime, users will likely regularly switch back and forth depending
> > on their needs.
> >
> > Thus, I'd like to see us finally make the switchover to 4k sectorsize
> > for new filesystems by default, regardless of page size.
> >
> > The initial test run by Hector Martin[3] at request of Qu Wenruo
> > looks promising[4], and I hope we can get this to land upstream soon.
> >
> > This is an update on the initial RFC patch[5], which addresses the
> > documentation feedback from Anand Jain.
> >
> > [0]: https://fedoraproject.org/wiki/SIGs/Asahi
> > [1]: https://asahi-fedora-remix.org/
> > [2]: https://vt.social/@lina/110060963422545117
> > [3]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#m11d7939de96c43b3a7cdabc7c568d8bcafc7ca83
> > [4]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#mf382b78a8122b0cb82147a536c85b6a9098a2895
> > [5]: https://lore.kernel.org/linux-btrfs/fdffeecd-964f-0c69-f869-eb9ceca20263@suse.com/T/#t
> >
>
> This all looks good to me, you can add
>
> Reviewed-by: Josef Bacik <josef@toxicpanda.com>
>
> I've got a mac studio on the way, I'll add this to our CI testing to make sure
> we've got good coverage of this code going forward.  Thanks,
>

Since we've got three Reviewed-by tags (you, Qu, and Anand), do I need
to send another version of this to land or can this land as-is?

-- 
真実はいつも一つ!/ Always, there's only one truth!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-22 17:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 18:06 [RFC PATCH v2 0/1] Enforce 4k sectorize by default for mkfs Neal Gompa
2023-03-21 18:06 ` [RFC PATCH v2 1/1] btrfs-progs: mkfs: Enforce 4k sectorsize by default Neal Gompa
2023-03-22  2:43   ` Anand Jain
2023-03-22  2:25 ` [RFC PATCH v2 0/1] Enforce 4k sectorize by default for mkfs Qu Wenruo
2023-03-22 14:33 ` Josef Bacik
2023-03-22 17:11   ` Neal Gompa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).