1 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
2 index d00d779..9308f35 100644
5 @@ -1179,6 +1179,9 @@ struct ext4_super_block {
6 #define EXT4_MF_MNTDIR_SAMPLED 0x0001
7 #define EXT4_MF_FS_ABORTED 0x0002 /* Fatal error detected */
9 +/* Number of quota types we support */
10 +#define EXT4_MAXQUOTAS 2
13 * fourth extended-fs super-block data in memory
15 @@ -1242,7 +1245,7 @@ struct ext4_sb_info {
17 struct block_device *journal_bdev;
19 - char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
20 + char *s_qf_names[EXT4_MAXQUOTAS]; /* Names of quota files with journalled quota */
21 int s_jquota_fmt; /* Format of quota to use */
23 unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
24 diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
25 index 17c00ff..9c5b49f 100644
26 --- a/fs/ext4/ext4_jbd2.h
27 +++ b/fs/ext4/ext4_jbd2.h
29 #define EXT4_QUOTA_INIT_BLOCKS(sb) 0
30 #define EXT4_QUOTA_DEL_BLOCKS(sb) 0
32 -#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
33 -#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
34 -#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
35 +#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
36 +#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
37 +#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
39 static inline int ext4_jbd2_credits_xattr(struct inode *inode)
41 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
42 index 7f2c846..24ef7b2 100644
45 @@ -820,7 +820,7 @@ static void ext4_put_super(struct super_block *sb)
46 percpu_counter_destroy(&sbi->s_extent_cache_cnt);
49 - for (i = 0; i < MAXQUOTAS; i++)
50 + for (i = 0; i < EXT4_MAXQUOTAS; i++)
51 kfree(sbi->s_qf_names[i]);
54 @@ -2224,7 +2224,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
55 /* Needed for iput() to work correctly and not trash data */
56 sb->s_flags |= MS_ACTIVE;
57 /* Turn on quotas so that they are updated correctly */
58 - for (i = 0; i < MAXQUOTAS; i++) {
59 + for (i = 0; i < EXT4_MAXQUOTAS; i++) {
60 if (EXT4_SB(sb)->s_qf_names[i]) {
61 int ret = ext4_quota_on_mount(sb, i);
63 @@ -2280,7 +2280,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
64 PLURAL(nr_truncates));
67 - for (i = 0; i < MAXQUOTAS; i++) {
68 + for (i = 0; i < EXT4_MAXQUOTAS; i++) {
69 if (sb_dqopt(sb)->files[i])
70 dquot_quota_off(sb, i);
72 @@ -4322,7 +4322,7 @@ failed_mount:
73 remove_proc_entry(sb->s_id, ext4_proc_root);
76 - for (i = 0; i < MAXQUOTAS; i++)
77 + for (i = 0; i < EXT4_MAXQUOTAS; i++)
78 kfree(sbi->s_qf_names[i]);
80 ext4_blkdev_remove(sbi);
81 @@ -4858,7 +4858,7 @@ struct ext4_mount_options {
82 u32 s_min_batch_time, s_max_batch_time;
85 - char *s_qf_names[MAXQUOTAS];
86 + char *s_qf_names[EXT4_MAXQUOTAS];
90 @@ -4888,7 +4888,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
91 old_opts.s_max_batch_time = sbi->s_max_batch_time;
93 old_opts.s_jquota_fmt = sbi->s_jquota_fmt;
94 - for (i = 0; i < MAXQUOTAS; i++)
95 + for (i = 0; i < EXT4_MAXQUOTAS; i++)
96 if (sbi->s_qf_names[i]) {
97 old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i],
99 @@ -5062,7 +5062,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
102 /* Release old quota file names */
103 - for (i = 0; i < MAXQUOTAS; i++)
104 + for (i = 0; i < EXT4_MAXQUOTAS; i++)
105 kfree(old_opts.s_qf_names[i]);
107 if (sb_any_quota_suspended(sb))
108 @@ -5091,7 +5091,7 @@ restore_opts:
109 sbi->s_max_batch_time = old_opts.s_max_batch_time;
111 sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
112 - for (i = 0; i < MAXQUOTAS; i++) {
113 + for (i = 0; i < EXT4_MAXQUOTAS; i++) {
114 kfree(sbi->s_qf_names[i]);
115 sbi->s_qf_names[i] = old_opts.s_qf_names[i];
117 @@ -5294,7 +5294,7 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
120 struct inode *qf_inode;
121 - unsigned long qf_inums[MAXQUOTAS] = {
122 + unsigned long qf_inums[EXT4_MAXQUOTAS] = {
123 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
124 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
126 @@ -5322,13 +5322,13 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
127 static int ext4_enable_quotas(struct super_block *sb)
130 - unsigned long qf_inums[MAXQUOTAS] = {
131 + unsigned long qf_inums[EXT4_MAXQUOTAS] = {
132 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
133 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
136 sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
137 - for (type = 0; type < MAXQUOTAS; type++) {
138 + for (type = 0; type < EXT4_MAXQUOTAS; type++) {
139 if (qf_inums[type]) {
140 err = ext4_quota_enable(sb, type, QFMT_VFS_V1,
141 DQUOT_USAGE_ENABLED);