Linux-ext4 Archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Srivathsa Dara <srivathsa.d.dara@oracle.com>
Cc: linux-ext4@vger.kernel.org, adilger@dilger.ca,
	rajesh.sivaramasubramaniom@oracle.com, junxiao.bi@oracle.com
Subject: Re: [PATCH v2] e2fsprogs: misc/mke2fs.8.in: Correct valid cluster-size values
Date: Mon, 25 Mar 2024 08:55:50 -0700	[thread overview]
Message-ID: <20240325155550.GA6371@frogsfrogsfrogs> (raw)
In-Reply-To: <20240325103621.1266289-1-srivathsa.d.dara@oracle.com>

On Mon, Mar 25, 2024 at 10:36:21AM +0000, Srivathsa Dara wrote:
> 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.
> ---
>  misc/mke2fs.8.in | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
> index 30f97bb5..8194cc41 100644
> --- a/misc/mke2fs.8.in
> +++ b/misc/mke2fs.8.in
> @@ -232,9 +232,9 @@ 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 per cluster.  This can only be specified if the

I think it's redundant to say cluster twice in this sentence:

"The cluster size must be a power of two between 2 and 32768 times the
filesystem block size."

It's also worth mentioning that mkfs rounds the parameter down to the
nearest power of two, e.g. "-C 20k" gets you a 16k cluster size.

--D

> +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
> 
> 

      reply	other threads:[~2024-03-25 15:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 10:36 [PATCH v2] e2fsprogs: misc/mke2fs.8.in: Correct valid cluster-size values Srivathsa Dara
2024-03-25 15:55 ` Darrick J. Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240325155550.GA6371@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=adilger@dilger.ca \
    --cc=junxiao.bi@oracle.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=rajesh.sivaramasubramaniom@oracle.com \
    --cc=srivathsa.d.dara@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).