diff mbox series

[2/4] btrfs-progs: mkfs: add "--blocksize" option as an alias for "--sectorsize"

Message ID 1542ae393d18844ed4edc5442d0ab46e8b14d74d.1734324435.git.wqu@suse.com (mailing list archive)
State New
Headers show
Series btrfs-progs: rename "sector size" to "block size" | expand

Commit Message

Qu Wenruo Dec. 16, 2024, 4:51 a.m. UTC
Btrfs uses the terminology "sectorsize" for the minimum data allocation
size, which is very different from other filesystems, and can be a
little confusing with the kernel block io sector size (which is the
minimum block io size, and is fixed to 512 bytes).

Let's start migrating mkfs.btrfs and its documentation to use the more
common terminology instead.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 Documentation/mkfs.btrfs.rst | 20 +++++++++++++-------
 mkfs/main.c                  |  3 ++-
 2 files changed, 15 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/mkfs.btrfs.rst b/Documentation/mkfs.btrfs.rst
index b830f8c5be07..2102fab11fe2 100644
--- a/Documentation/mkfs.btrfs.rst
+++ b/Documentation/mkfs.btrfs.rst
@@ -94,7 +94,7 @@  OPTIONS
         mode may lead to degraded performance on larger filesystems, but is otherwise
         usable, even on multiple devices.
 
-        The *nodesize* and *sectorsize* must be equal, and the block group types must
+        The *nodesize* and *blocksize* must be equal, and the block group types must
         match.
 
         .. note::
@@ -108,7 +108,7 @@  OPTIONS
 -n|--nodesize <size>
         Specify the nodesize, the tree block size in which btrfs stores metadata. The
         default value is 16KiB (16384) or the page size, whichever is bigger. Must be a
-        multiple of the sectorsize and a power of 2, but not larger than 64KiB (65536).
+        multiple of the blocksize and a power of 2, but not larger than 64KiB (65536).
         Leafsize always equals nodesize and the options are aliases.
 
         Smaller node size increases fragmentation but leads to taller b-trees which in
@@ -119,11 +119,17 @@  OPTIONS
         .. note::
                 Versions up to 3.11 set the nodesize to 4KiB.
 
--s|--sectorsize <size>
-        Specify the sectorsize, the minimum data block allocation unit.
+-s|--sectorsize|--blocksize <size>
+        Specify the block size, the minimum data block allocation unit.
 
-        .. note::
-                Versions prior to 6.7 set the sectorsize matching the host CPU
+	.. note::
+		Btrfs-progs versions prior to 6.14 uses the name "sectorsize" to
+		describe the minimum data block allocation unit, which is not
+		following other filesystems' terminology.
+		From version 6.14, documentation and source code will convert
+		to use the name "blocksize" instead.
+
+                Versions prior to 6.7 set the blocksize matching the host CPU
                 page size, starting in 6.7 this is 4KiB for cross-architecture
                 compatibility. Please read more about the :doc:`subpage block size support<Subpage>`
                 and :ref:`its status<status-subpage-block-size>`.
@@ -618,7 +624,7 @@  The combination of small filesystem size and large nodesize is not recommended
 in general and can lead to various ENOSPC-related issues during mount time or runtime.
 
 Since mixed block group creation is optional, we allow small
-filesystem instances with differing values for *sectorsize* and *nodesize*
+filesystem instances with differing values for *blocksize* and *nodesize*
 to be created and could end up in the following situation:
 
 .. code-block:: none
diff --git a/mkfs/main.c b/mkfs/main.c
index 2faabc550887..87c08f3ff9a2 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -432,7 +432,7 @@  static const char * const mkfs_usage[] = {
 	OPTLINE("--csum TYPE", ""),
 	OPTLINE("--checksum TYPE", "checksum algorithm to use, crc32c (default), xxhash, sha256, blake2"),
 	OPTLINE("-n|--nodesize SIZE", "size of btree nodes"),
-	OPTLINE("-s|--sectorsize SIZE", "data block size (may not be mountable by current kernel)"),
+	OPTLINE("-s|--sectorsize|--blocksize SIZE", "data block size (may not be mountable by current kernel)"),
 	OPTLINE("-O|--features LIST", "comma separated list of filesystem features (use '-O list-all' to list features)"),
 	OPTLINE("-L|--label LABEL", "set the filesystem label"),
 	OPTLINE("-U|--uuid UUID", "specify the filesystem UUID (must be unique for a filesystem with multiple devices)"),
@@ -1105,6 +1105,7 @@  int BOX_MAIN(mkfs)(int argc, char **argv)
 			{ "shrink", no_argument, NULL, GETOPT_VAL_SHRINK },
 			{ "compress", required_argument, NULL,
 				GETOPT_VAL_COMPRESS },
+			{ "blocksize", required_argument, NULL, 's' },
 #if EXPERIMENTAL
 			{ "param", required_argument, NULL, GETOPT_VAL_PARAM },
 			{ "num-global-roots", required_argument, NULL, GETOPT_VAL_GLOBAL_ROOTS },