All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH 2/5] mke2fs: automatically use 256 byte inodes if project feature enabled
Date: Wed, 23 Aug 2017 11:42:07 -0400	[thread overview]
Message-ID: <20170823154210.8756-2-tytso@mit.edu> (raw)
In-Reply-To: <20170823154210.8756-1-tytso@mit.edu>

If the inode size is not implicitly requested on the command line, and
it is too small to support the project feature, automatically promote
the inode size to be 256 bytes so that the project feature will work.

Note the previous test to check for a too-small inode size didn't work
because it checked before inode size was set in fs_param.  Hence, it
was possible to create file systems with a 128 byte inode and the
project feature enabled.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 misc/mke2fs.c | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index b8d078a0a..7fd7fae40 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2319,6 +2319,26 @@ profile_error:
 			(unsigned long long) fs_blocks_count);
 	}
 
+	if (quotatype_bits & QUOTA_PRJ_BIT)
+		ext2fs_set_feature_project(&fs_param);
+
+	if (ext2fs_has_feature_project(&fs_param)) {
+		quotatype_bits |= QUOTA_PRJ_BIT;
+		if (inode_size == EXT2_GOOD_OLD_INODE_SIZE) {
+			com_err(program_name, 0,
+				_("%d byte inodes are too small for "
+				  "project quota"),
+				inode_size);
+			exit(1);
+		}
+		if (inode_size == 0) {
+			inode_size = get_int_from_profile(fs_types,
+							  "inode_size", 0);
+			if (inode_size <= EXT2_GOOD_OLD_INODE_SIZE*2)
+				inode_size = EXT2_GOOD_OLD_INODE_SIZE*2;
+		}
+	}
+
 	/* Don't allow user to set both metadata_csum and uninit_bg bits. */
 	if (ext2fs_has_feature_metadata_csum(&fs_param) &&
 	    ext2fs_has_feature_gdt_csum(&fs_param))
@@ -2419,19 +2439,6 @@ profile_error:
 		exit(1);
 	}
 
-	/*
-	 * If inode size is 128 and project quota is enabled, we need
-	 * to notify users that project ID will never be useful.
-	 */
-	if (ext2fs_has_feature_project(&fs_param) &&
-	    fs_param.s_inode_size == EXT2_GOOD_OLD_INODE_SIZE) {
-		com_err(program_name, 0,
-			_("%d byte inodes are too small for project quota; "
-			  "specify larger size"),
-			fs_param.s_inode_size);
-		exit(1);
-	}

  reply	other threads:[~2017-08-23 15:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 15:42 [PATCH 1/5] mke2fs.conf: remove legacy entry for ext4dev Theodore Ts'o
2017-08-23 15:42 ` Theodore Ts'o [this message]
2017-08-23 15:42 ` [PATCH 3/5] tune2fs: do not enable project feature or quota if inode size is 128 bytes Theodore Ts'o
2017-08-23 15:42 ` [PATCH 4/5] tune2fs: explain why an fsck is needed Theodore Ts'o
2017-08-23 15:42 ` [PATCH 5/5] tune2fs, mke2fs: clarify proceed delay question Theodore Ts'o
2017-08-23 17:17 ` [PATCH 1/5] mke2fs.conf: remove legacy entry for ext4dev Darrick J. Wong

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=20170823154210.8756-2-tytso@mit.edu \
    --to=tytso@mit.edu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.