Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jan Kara and committed by
Theodore Ts'o
a2d4a646 a49058fa

+18 -15
+4 -1
fs/ext4/ext4.h
··· 1175 1175 #define EXT4_MF_MNTDIR_SAMPLED 0x0001 1176 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 1182 * fourth extended-fs super-block data in memory 1180 1183 */ ··· 1241 1238 u32 s_min_batch_time; 1242 1239 struct block_device *journal_bdev; 1243 1240 #ifdef CONFIG_QUOTA 1244 - char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ 1241 + char *s_qf_names[EXT4_MAXQUOTAS]; /* Names of quota files with journalled quota */ 1245 1242 int s_jquota_fmt; /* Format of quota to use */ 1246 1243 #endif 1247 1244 unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
+3 -3
fs/ext4/ext4_jbd2.h
··· 102 102 #define EXT4_QUOTA_INIT_BLOCKS(sb) 0 103 103 #define EXT4_QUOTA_DEL_BLOCKS(sb) 0 104 104 #endif 105 - #define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb)) 106 - #define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb)) 107 - #define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb)) 105 + #define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb)) 106 + #define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb)) 107 + #define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb)) 108 108 109 109 static inline int ext4_jbd2_credits_xattr(struct inode *inode) 110 110 {
+11 -11
fs/ext4/super.c
··· 822 822 percpu_counter_destroy(&sbi->s_dirtyclusters_counter); 823 823 brelse(sbi->s_sbh); 824 824 #ifdef CONFIG_QUOTA 825 - for (i = 0; i < MAXQUOTAS; i++) 825 + for (i = 0; i < EXT4_MAXQUOTAS; i++) 826 826 kfree(sbi->s_qf_names[i]); 827 827 #endif 828 828 ··· 2207 2207 /* Needed for iput() to work correctly and not trash data */ 2208 2208 sb->s_flags |= MS_ACTIVE; 2209 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 2211 if (EXT4_SB(sb)->s_qf_names[i]) { 2212 2212 int ret = ext4_quota_on_mount(sb, i); 2213 2213 if (ret < 0) ··· 2263 2263 PLURAL(nr_truncates)); 2264 2264 #ifdef CONFIG_QUOTA 2265 2265 /* Turn quotas off */ 2266 - for (i = 0; i < MAXQUOTAS; i++) { 2266 + for (i = 0; i < EXT4_MAXQUOTAS; i++) { 2267 2267 if (sb_dqopt(sb)->files[i]) 2268 2268 dquot_quota_off(sb, i); 2269 2269 } ··· 4238 4238 remove_proc_entry(sb->s_id, ext4_proc_root); 4239 4239 } 4240 4240 #ifdef CONFIG_QUOTA 4241 - for (i = 0; i < MAXQUOTAS; i++) 4241 + for (i = 0; i < EXT4_MAXQUOTAS; i++) 4242 4242 kfree(sbi->s_qf_names[i]); 4243 4243 #endif 4244 4244 ext4_blkdev_remove(sbi); ··· 4765 4765 u32 s_min_batch_time, s_max_batch_time; 4766 4766 #ifdef CONFIG_QUOTA 4767 4767 int s_jquota_fmt; 4768 - char *s_qf_names[MAXQUOTAS]; 4768 + char *s_qf_names[EXT4_MAXQUOTAS]; 4769 4769 #endif 4770 4770 }; 4771 4771 ··· 4795 4795 old_opts.s_max_batch_time = sbi->s_max_batch_time; 4796 4796 #ifdef CONFIG_QUOTA 4797 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 4799 if (sbi->s_qf_names[i]) { 4800 4800 old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i], 4801 4801 GFP_KERNEL); ··· 4956 4956 4957 4957 #ifdef CONFIG_QUOTA 4958 4958 /* Release old quota file names */ 4959 - for (i = 0; i < MAXQUOTAS; i++) 4959 + for (i = 0; i < EXT4_MAXQUOTAS; i++) 4960 4960 kfree(old_opts.s_qf_names[i]); 4961 4961 if (enable_quota) { 4962 4962 if (sb_any_quota_suspended(sb)) ··· 4985 4985 sbi->s_max_batch_time = old_opts.s_max_batch_time; 4986 4986 #ifdef CONFIG_QUOTA 4987 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 4989 kfree(sbi->s_qf_names[i]); 4990 4990 sbi->s_qf_names[i] = old_opts.s_qf_names[i]; 4991 4991 } ··· 5188 5188 { 5189 5189 int err; 5190 5190 struct inode *qf_inode; 5191 - unsigned long qf_inums[MAXQUOTAS] = { 5191 + unsigned long qf_inums[EXT4_MAXQUOTAS] = { 5192 5192 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum), 5193 5193 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum) 5194 5194 }; ··· 5216 5216 static int ext4_enable_quotas(struct super_block *sb) 5217 5217 { 5218 5218 int type, err = 0; 5219 - unsigned long qf_inums[MAXQUOTAS] = { 5219 + unsigned long qf_inums[EXT4_MAXQUOTAS] = { 5220 5220 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum), 5221 5221 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum) 5222 5222 }; 5223 5223 5224 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 5226 if (qf_inums[type]) { 5227 5227 err = ext4_quota_enable(sb, type, QFMT_VFS_V1, 5228 5228 DQUOT_USAGE_ENABLED);