linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: gnehzuil.liu@gmail.com, Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH 1/5] mke2fs: enforce that the cluster size must be less that the block size
Date: Mon, 14 Jan 2013 19:37:08 -0500	[thread overview]
Message-ID: <1358210232-30578-1-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <20130114211014.GA22642@thunk.org>

In addition, do not allow a cluster size of 1024, since that will be
interpreted by ext2fs_initialize() as requesting the default cluster
size.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Zheng Liu <wenqing.lz@taobao.com>
---
 misc/mke2fs.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 4748f4a..75d0e48 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1346,7 +1346,7 @@ profile_error:
 			break;
 		case 'C':
 			cluster_size = strtoul(optarg, &tmp, 0);
-			if (cluster_size < EXT2_MIN_CLUSTER_SIZE ||
+			if (cluster_size <= EXT2_MIN_CLUSTER_SIZE ||
 			    cluster_size > EXT2_MAX_CLUSTER_SIZE || *tmp) {
 				com_err(program_name, 0,
 					_("invalid cluster size - %s"),
@@ -1847,6 +1847,13 @@ profile_error:
 							    blocksize*16);
 		fs_param.s_log_cluster_size =
 			int_log2(cluster_size >> EXT2_MIN_CLUSTER_LOG_SIZE);
+		if (fs_param.s_log_cluster_size &&
+		    fs_param.s_log_cluster_size < fs_param.s_log_block_size) {
+			com_err(program_name, 0,
+				_("The cluster size must not be "
+				  "smaller than the block size.\n"));
+			exit(1);
+		}
 	} else if (cluster_size) {
 		com_err(program_name, 0,
 			_("specifying a cluster size requires the "
-- 
1.7.12.rc0.22.gcdd159b


  reply	other threads:[~2013-01-15  0:37 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
2013-01-14 21:07     ` Andreas Dilger
2013-01-14 21:10       ` Theodore Ts'o
2013-01-15  0:37         ` Theodore Ts'o [this message]
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=1358210232-30578-1-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=gnehzuil.liu@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    /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).