[PATCH 4/6] ext4: get rid of didicated MOUNT_QUOTA option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently didicated quota option is used only for options parsing phase,
which is very inefficient. Also show_opts output are not obvious in case
of journaled quota.

Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
---
 fs/ext4/ext4.h  |    2 +-
 fs/ext4/super.c |   16 +++++++---------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 9eedecb..e92c51a 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -904,9 +904,9 @@ struct ext4_inode_info {
 #define EXT4_MOUNT_POSIX_ACL		0x08000	/* POSIX Access Control Lists */
 #define EXT4_MOUNT_NO_AUTO_DA_ALLOC	0x10000	/* No auto delalloc mapping */
 #define EXT4_MOUNT_BARRIER		0x20000 /* Use block barriers */
-#define EXT4_MOUNT_QUOTA		0x80000 /* Some quota option set */
 #define EXT4_MOUNT_USRQUOTA		0x100000 /* "old" user quota */
 #define EXT4_MOUNT_GRPQUOTA		0x200000 /* "old" group quota */
+#define EXT4_MOUNT_QUOTA		0x300000 /* Some quota option set */
 #define EXT4_MOUNT_DIOREAD_NOLOCK	0x400000 /* Enable support for dio read nolocking */
 #define EXT4_MOUNT_JOURNAL_CHECKSUM	0x800000 /* Journal checksums */
 #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT	0x1000000 /* Journal Async Commit */
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 44d0c8d..74d2726 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1459,7 +1459,6 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
 		sbi->s_qf_names[qtype] = NULL;
 		return 0;
 	}
-	set_opt(sb, QUOTA);
 	return 1;
 }
 
@@ -1694,10 +1693,12 @@ static int parse_options(char *options, struct super_block *sb,
 		case Opt_offusrjquota:
 			if (!clear_qf_name(sb, USRQUOTA))
 				return 0;
+			clear_opt(sb, USRQUOTA);
 			break;
 		case Opt_offgrpjquota:
 			if (!clear_qf_name(sb, GRPQUOTA))
 				return 0;
+			clear_opt(sb, USRQUOTA);
 			break;
 
 		case Opt_jqfmt_vfsold:
@@ -1720,11 +1721,9 @@ set_qf_format:
 			break;
 		case Opt_quota:
 		case Opt_usrquota:
-			set_opt(sb, QUOTA);
 			set_opt(sb, USRQUOTA);
 			break;
 		case Opt_grpquota:
-			set_opt(sb, QUOTA);
 			set_opt(sb, GRPQUOTA);
 			break;
 		case Opt_noquota:
@@ -1734,8 +1733,6 @@ set_qf_format:
 				return 0;
 			}
 			clear_opt(sb, QUOTA);
-			clear_opt(sb, USRQUOTA);
-			clear_opt(sb, GRPQUOTA);
 			break;
 #else
 		case Opt_quota:
@@ -1894,23 +1891,24 @@ set_qf_format:
 	}
 #ifdef CONFIG_QUOTA
 	if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) {
+		int jquota = 0;
 		if (test_opt(sb, USRQUOTA) && sbi->s_qf_names[USRQUOTA])
-			clear_opt(sb, USRQUOTA);
+			jquota |= EXT4_MOUNT_USRQUOTA;
 
 		if (test_opt(sb, GRPQUOTA) && sbi->s_qf_names[GRPQUOTA])
-			clear_opt(sb, GRPQUOTA);
+			jquota |= EXT4_MOUNT_GRPQUOTA;
 
-		if (test_opt(sb, GRPQUOTA) || test_opt(sb, USRQUOTA)) {
+		if (test_opt(sb, QUOTA) != jquota) {
 			ext4_msg(sb, KERN_ERR, "old and new quota "
 					"format mixing");
 			return 0;
 		}
-
 		if (!sbi->s_jquota_fmt) {
 			ext4_msg(sb, KERN_ERR, "journaled quota format "
 					"not specified");
 			return 0;
 		}
+		EXT4_SB(sb)->s_mount_opt |= jquota;
 	} else {
 		if (sbi->s_jquota_fmt) {
 			ext4_msg(sb, KERN_ERR, "journaled quota format "
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux