linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Zheng Liu <gnehzuil.liu@gmail.com>
Cc: linux-ext4@vger.kernel.org, Zheng Liu <wenqing.lz@taobao.com>
Subject: Re: [PATCH 2/3] mke2fs: reduce the range of cluster-size
Date: Mon, 14 Jan 2013 16:03:49 -0500	[thread overview]
Message-ID: <20130114210349.GB8049@thunk.org> (raw)
In-Reply-To: <1358068095-9034-2-git-send-email-wenqing.lz@taobao.com>

On Sun, Jan 13, 2013 at 05:08:14PM +0800, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
> 
> There are two bugs need to be fixed, which are about cluster-size.
> Now the range of cluster-size is from 1024 to 512M bytes.  Although
> with '-C 1024', the cluster-size will be 4096 after making a
> filesystem because in ext2fs_initialize() set_field() needs to check
> 'param->s_log_cluster_size' and s_log_cluster_size is 0 as
> cluster-size is 1024.  Then s_log_cluster_size will be assigned to
> s_log_block_size+4.  So we never set cluster-size to 1024.
> 
> Another bug is that when cluster-size is 512M EXT2FS_C2B will return
> 0.  So s_blocks_per_group will be assigned to zero and we will meet
> a 'division by zero' error.

There are a couple of things going on here.  The first is that it
makes no senes when the cluster size is less than or equal to the
block size.  (Actually, nothing bad should happen in the case when the
cluster size == block size, but if the user specified the bigalloc
feature, that's something which they almost certainly don't want.)

So the more general check is we should be complaining if the cluster
size is <= the block size.  That is, the combination of -b 4096 and -C
2048 makes no sense, either.

Also, there's technically nothing wrong with a cluster size of 512MB.
The problem is in how we calculate the default number of clusters per
group --- if it translates to a number of blocks per group which
overals 2**32, that's when we run into problems.

Which leads to another bug in the current mke2fs command.  The range
checking for the -g (which allows you to specify the number of blocks
per group is bogus in the case when the bigalloc feature is enabled).
I think the best way of fixing this is to document that the -g option
specifies the number of clusters per block if the bigalloc feature is
enabled.

						- Ted

  parent reply	other threads:[~2013-01-14 21:03 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-13  9:08 [PATCH 1/3] mke2fs: indicate bigalloc feature explicity when cluster-size is enabled Zheng Liu
2013-01-13  9:08 ` [PATCH 2/3] mke2fs: reduce the range of cluster-size Zheng Liu
2013-01-14 17:41   ` Andreas Dilger
2013-01-14 21:03   ` Theodore Ts'o [this message]
2013-01-14 21:07     ` Andreas Dilger
2013-01-14 21:10       ` Theodore Ts'o
2013-01-15  0:37         ` [PATCH 1/5] mke2fs: enforce that the cluster size must be less that the block size Theodore Ts'o
2013-01-15  0:37           ` [PATCH 2/5] mke2fs: the -g option will now specify the clusters per block group Theodore Ts'o
2013-01-15 15:10             ` Eric Sandeen
2013-01-15 19:05               ` Theodore Ts'o
2013-01-15 15:22             ` Zheng Liu
2013-01-15  0:37           ` [PATCH 3/5] libe2p: teach parse_num_blocks2() to return bytes if log_block_size < 0 Theodore Ts'o
2013-01-15 15:23             ` Zheng Liu
2013-01-15  0:37           ` [PATCH 4/5] mke2fs: teach mke2fs to understand -b 4k and -C 256M Theodore Ts'o
2013-01-15 15:11             ` Eric Sandeen
2013-01-15 15:13               ` Eric Sandeen
2013-01-15 15:24             ` Zheng Liu
2013-01-15  0:37           ` [PATCH 5/5] libext2fs: avoid 32-bit overflow in ext2fs_initialize with a 512M cluster size Theodore Ts'o
2013-01-15 15:33             ` Zheng Liu
2013-01-15 15:36               ` Zheng Liu
2013-01-15 19:10               ` Theodore Ts'o
2013-01-16  1:49                 ` Zheng Liu
2013-01-15  0:41           ` [PATCH 1/5] mke2fs: enforce that the cluster size must be less that the block size Theodore Ts'o
2013-01-15 15:22             ` Zheng Liu
2013-01-13  9:08 ` [PATCH 3/3] mke2fs: document bigalloc and cluster-size Zheng Liu
2013-01-15  3:10   ` Theodore Ts'o
2013-01-15 19:12     ` Theodore Ts'o
2013-01-15 19:46       ` Phillip Susi
2013-01-15 19:57         ` Theodore Ts'o
2013-01-15 20:38           ` Phillip Susi
2013-01-15 22:28             ` Theodore Ts'o
2013-01-14 20:28 ` [PATCH 1/3] mke2fs: indicate bigalloc feature explicity when cluster-size is enabled Theodore Ts'o

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=20130114210349.GB8049@thunk.org \
    --to=tytso@mit.edu \
    --cc=gnehzuil.liu@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=wenqing.lz@taobao.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 NNTP newsgroup(s).