aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2014-09-11 11:15:15 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-09-11 11:15:15 -0400
commita2d4a646e619541e803fb52636964df39aed94b7 (patch)
tree439906c07ebb373a4d6b3a662f3ecfafc502337e
parenta49058fab2912296f068759490ac69ba43b43861 (diff)
ext4: don't use MAXQUOTAS value
MAXQUOTAS value defines maximum number of quota types VFS supports. This isn't necessarily the number of types ext4 supports. Although ext4 will support project quotas, use ext4 private definition for consistency with other filesystems. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/ext4/ext4.h5
-rw-r--r--fs/ext4/ext4_jbd2.h6
-rw-r--r--fs/ext4/super.c22
3 files changed, 18 insertions, 15 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index f70c3fc94296..1eb5b7b912a8 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1175,6 +1175,9 @@ struct ext4_super_block {
1175#define EXT4_MF_MNTDIR_SAMPLED 0x0001 1175#define EXT4_MF_MNTDIR_SAMPLED 0x0001
1176#define EXT4_MF_FS_ABORTED 0x0002 /* Fatal error detected */ 1176#define EXT4_MF_FS_ABORTED 0x0002 /* Fatal error detected */
1177 1177
1178/* Number of quota types we support */
1179#define EXT4_MAXQUOTAS 2
1180
1178/* 1181/*
1179 * fourth extended-fs super-block data in memory 1182 * fourth extended-fs super-block data in memory
1180 */ 1183 */
@@ -1238,7 +1241,7 @@ struct ext4_sb_info {
1238 u32 s_min_batch_time; 1241 u32 s_min_batch_time;
1239 struct block_device *journal_bdev; 1242 struct block_device *journal_bdev;
1240#ifdef CONFIG_QUOTA 1243#ifdef CONFIG_QUOTA
1241 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ 1244 char *s_qf_names[EXT4_MAXQUOTAS]; /* Names of quota files with journalled quota */
1242 int s_jquota_fmt; /* Format of quota to use */ 1245 int s_jquota_fmt; /* Format of quota to use */
1243#endif 1246#endif
1244 unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */ 1247 unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index 17c00ff202f2..9c5b49fb281e 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -102,9 +102,9 @@
102#define EXT4_QUOTA_INIT_BLOCKS(sb) 0 102#define EXT4_QUOTA_INIT_BLOCKS(sb) 0
103#define EXT4_QUOTA_DEL_BLOCKS(sb) 0 103#define EXT4_QUOTA_DEL_BLOCKS(sb) 0
104#endif 104#endif
105#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb)) 105#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
106#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb)) 106#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
107#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb)) 107#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
108 108
109static inline int ext4_jbd2_credits_xattr(struct inode *inode) 109static inline int ext4_jbd2_credits_xattr(struct inode *inode)
110{ 110{
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 4b81747b3a80..a318a2dfc79e 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -822,7 +822,7 @@ static void ext4_put_super(struct super_block *sb)
822 percpu_counter_destroy(&sbi->s_dirtyclusters_counter); 822 percpu_counter_destroy(&sbi->s_dirtyclusters_counter);
823 brelse(sbi->s_sbh); 823 brelse(sbi->s_sbh);
824#ifdef CONFIG_QUOTA 824#ifdef CONFIG_QUOTA
825 for (i = 0; i < MAXQUOTAS; i++) 825 for (i = 0; i < EXT4_MAXQUOTAS; i++)
826 kfree(sbi->s_qf_names[i]); 826 kfree(sbi->s_qf_names[i]);
827#endif 827#endif
828 828
@@ -2207,7 +2207,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
2207 /* Needed for iput() to work correctly and not trash data */ 2207 /* Needed for iput() to work correctly and not trash data */
2208 sb->s_flags |= MS_ACTIVE; 2208 sb->s_flags |= MS_ACTIVE;
2209 /* Turn on quotas so that they are updated correctly */ 2209 /* Turn on quotas so that they are updated correctly */
2210 for (i = 0; i < MAXQUOTAS; i++) { 2210 for (i = 0; i < EXT4_MAXQUOTAS; i++) {
2211 if (EXT4_SB(sb)->s_qf_names[i]) { 2211 if (EXT4_SB(sb)->s_qf_names[i]) {
2212 int ret = ext4_quota_on_mount(sb, i); 2212 int ret = ext4_quota_on_mount(sb, i);
2213 if (ret < 0) 2213 if (ret < 0)
@@ -2263,7 +2263,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
2263 PLURAL(nr_truncates)); 2263 PLURAL(nr_truncates));
2264#ifdef CONFIG_QUOTA 2264#ifdef CONFIG_QUOTA
2265 /* Turn quotas off */ 2265 /* Turn quotas off */
2266 for (i = 0; i < MAXQUOTAS; i++) { 2266 for (i = 0; i < EXT4_MAXQUOTAS; i++) {
2267 if (sb_dqopt(sb)->files[i]) 2267 if (sb_dqopt(sb)->files[i])
2268 dquot_quota_off(sb, i); 2268 dquot_quota_off(sb, i);
2269 } 2269 }
@@ -4238,7 +4238,7 @@ failed_mount:
4238 remove_proc_entry(sb->s_id, ext4_proc_root); 4238 remove_proc_entry(sb->s_id, ext4_proc_root);
4239 } 4239 }
4240#ifdef CONFIG_QUOTA 4240#ifdef CONFIG_QUOTA
4241 for (i = 0; i < MAXQUOTAS; i++) 4241 for (i = 0; i < EXT4_MAXQUOTAS; i++)
4242 kfree(sbi->s_qf_names[i]); 4242 kfree(sbi->s_qf_names[i]);
4243#endif 4243#endif
4244 ext4_blkdev_remove(sbi); 4244 ext4_blkdev_remove(sbi);
@@ -4765,7 +4765,7 @@ struct ext4_mount_options {
4765 u32 s_min_batch_time, s_max_batch_time; 4765 u32 s_min_batch_time, s_max_batch_time;
4766#ifdef CONFIG_QUOTA 4766#ifdef CONFIG_QUOTA
4767 int s_jquota_fmt; 4767 int s_jquota_fmt;
4768 char *s_qf_names[MAXQUOTAS]; 4768 char *s_qf_names[EXT4_MAXQUOTAS];
4769#endif 4769#endif
4770}; 4770};
4771 4771
@@ -4795,7 +4795,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
4795 old_opts.s_max_batch_time = sbi->s_max_batch_time; 4795 old_opts.s_max_batch_time = sbi->s_max_batch_time;
4796#ifdef CONFIG_QUOTA 4796#ifdef CONFIG_QUOTA
4797 old_opts.s_jquota_fmt = sbi->s_jquota_fmt; 4797 old_opts.s_jquota_fmt = sbi->s_jquota_fmt;
4798 for (i = 0; i < MAXQUOTAS; i++) 4798 for (i = 0; i < EXT4_MAXQUOTAS; i++)
4799 if (sbi->s_qf_names[i]) { 4799 if (sbi->s_qf_names[i]) {
4800 old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i], 4800 old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i],
4801 GFP_KERNEL); 4801 GFP_KERNEL);
@@ -4956,7 +4956,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
4956 4956
4957#ifdef CONFIG_QUOTA 4957#ifdef CONFIG_QUOTA
4958 /* Release old quota file names */ 4958 /* Release old quota file names */
4959 for (i = 0; i < MAXQUOTAS; i++) 4959 for (i = 0; i < EXT4_MAXQUOTAS; i++)
4960 kfree(old_opts.s_qf_names[i]); 4960 kfree(old_opts.s_qf_names[i]);
4961 if (enable_quota) { 4961 if (enable_quota) {
4962 if (sb_any_quota_suspended(sb)) 4962 if (sb_any_quota_suspended(sb))
@@ -4985,7 +4985,7 @@ restore_opts:
4985 sbi->s_max_batch_time = old_opts.s_max_batch_time; 4985 sbi->s_max_batch_time = old_opts.s_max_batch_time;
4986#ifdef CONFIG_QUOTA 4986#ifdef CONFIG_QUOTA
4987 sbi->s_jquota_fmt = old_opts.s_jquota_fmt; 4987 sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
4988 for (i = 0; i < MAXQUOTAS; i++) { 4988 for (i = 0; i < EXT4_MAXQUOTAS; i++) {
4989 kfree(sbi->s_qf_names[i]); 4989 kfree(sbi->s_qf_names[i]);
4990 sbi->s_qf_names[i] = old_opts.s_qf_names[i]; 4990 sbi->s_qf_names[i] = old_opts.s_qf_names[i];
4991 } 4991 }
@@ -5188,7 +5188,7 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
5188{ 5188{
5189 int err; 5189 int err;
5190 struct inode *qf_inode; 5190 struct inode *qf_inode;
5191 unsigned long qf_inums[MAXQUOTAS] = { 5191 unsigned long qf_inums[EXT4_MAXQUOTAS] = {
5192 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum), 5192 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
5193 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum) 5193 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
5194 }; 5194 };
@@ -5216,13 +5216,13 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
5216static int ext4_enable_quotas(struct super_block *sb) 5216static int ext4_enable_quotas(struct super_block *sb)
5217{ 5217{
5218 int type, err = 0; 5218 int type, err = 0;
5219 unsigned long qf_inums[MAXQUOTAS] = { 5219 unsigned long qf_inums[EXT4_MAXQUOTAS] = {
5220 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum), 5220 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
5221 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum) 5221 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
5222 }; 5222 };
5223 5223
5224 sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE; 5224 sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
5225 for (type = 0; type < MAXQUOTAS; type++) { 5225 for (type = 0; type < EXT4_MAXQUOTAS; type++) {
5226 if (qf_inums[type]) { 5226 if (qf_inums[type]) {
5227 err = ext4_quota_enable(sb, type, QFMT_VFS_V1, 5227 err = ext4_quota_enable(sb, type, QFMT_VFS_V1,
5228 DQUOT_USAGE_ENABLED); 5228 DQUOT_USAGE_ENABLED);