public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] e2fsprogs: misc/mke2fs.8.in: Correct valid cluster-size values
@ 2024-04-03  4:30 Srivathsa Dara
  2024-04-03  4:36 ` Darrick J. Wong
  2024-04-17  2:03 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Srivathsa Dara @ 2024-04-03  4:30 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, adilger, djwong, rajesh.sivaramasubramaniom, junxiao.bi

According to the mke2fs man page, the supported cluster-size values
for an ext4 filesystem are 2048 to 256M bytes. However, this is not
the case.

When mkfs is run to create a filesystem with following specifications:
* 1k blocksize and cluster-size greater than 32M
* 2k blocksize and cluster-size greater than 64M
* 4k blocksize and cluster-size greater than 128M
mkfs fails with "Invalid argument passed to ext2 library while trying
to create journal" error. In general, when the cluster-size to blocksize
ratio is greater than 32k, mkfs fails with this error.

Went through the code and found out that the function
`ext2fs_new_range()` is the source of this error. This is because when
the cluster-size to blocksize ratio exceeds 32k, the length argument
to the function `ext2fs_new_range()` results in 0. Hence, the error.

This patch corrects the valid cluster-size values.

v2->v3:
Remove redundant words and add info about how cluster-sizes that are
not powers of 2 are rounded.
---
 misc/mke2fs.8.in | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 30f97bb5..c7b21f9d 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -232,9 +232,13 @@ test is used instead of a fast read-only test.
 .TP
 .B \-C " cluster-size"
 Specify the size of cluster in bytes for file systems using the bigalloc
-feature.  Valid cluster-size values are from 2048 to 256M bytes per
-cluster.  This can only be specified if the bigalloc feature is
-enabled.  (See the
+feature. Valid cluster-size values range from 2 to 32768 times the
+filesystem blocksize and must be a power of 2. If a cluster-size that is
+not a power of 2 is provided, it will be rounded down to the nearest
+power of 2 that is less than the given cluster-size. For example,
+specifying '-C 20k', '-C 30k', or '-C 17k' will result in a cluster-size
+of 16k. The cluster-size can only be specified if the
+bigalloc feature is enabled.  (See the
 .B ext4 (5)
 man page for more details about bigalloc.)   The default cluster size if
 bigalloc is enabled is 16 times the block size.
-- 
2.39.3


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

end of thread, other threads:[~2024-04-17  2:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03  4:30 [PATCH v3] e2fsprogs: misc/mke2fs.8.in: Correct valid cluster-size values Srivathsa Dara
2024-04-03  4:36 ` Darrick J. Wong
2024-04-17  2:03 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox