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)
42 Index: linux-3.10.0-1062.el7.x86_64/fs/ext4/super.c
43 ===================================================================
44 --- linux-3.10.0-1062.el7.x86_64.orig/fs/ext4/super.c
45 +++ linux-3.10.0-1062.el7.x86_64/fs/ext4/super.c
46 @@ -819,7 +819,7 @@ static inline void ext4_quota_off_umount
49 /* Use our quota_off function to clear inode flags etc. */
50 - for (type = 0; type < MAXQUOTAS; type++)
51 + for (type = 0; type < EXT4_MAXQUOTAS; type++)
52 ext4_quota_off(sb, type);
55 @@ -879,7 +879,7 @@ static void ext4_put_super(struct super_
56 percpu_counter_destroy(&sbi->s_dirtyclusters_counter);
57 percpu_counter_destroy(&sbi->s_extent_cache_cnt);
59 - for (i = 0; i < MAXQUOTAS; i++)
60 + for (i = 0; i < EXT4_MAXQUOTAS; i++)
61 kfree(sbi->s_qf_names[i]);
64 @@ -2356,7 +2356,7 @@ static void ext4_orphan_cleanup(struct s
67 /* Turn on journaled quotas used for old sytle */
68 - for (i = 0; i < MAXQUOTAS; i++) {
69 + for (i = 0; i < EXT4_MAXQUOTAS; i++) {
70 if (EXT4_SB(sb)->s_qf_names[i]) {
71 int ret = ext4_quota_on_mount(sb, i);
73 @@ -2426,7 +2426,7 @@ static void ext4_orphan_cleanup(struct s
75 /* Turn off quotas if they were enabled for orphan cleanup */
77 - for (i = 0; i < MAXQUOTAS; i++) {
78 + for (i = 0; i < EXT4_MAXQUOTAS; i++) {
79 if (sb_dqopt(sb)->files[i])
80 dquot_quota_off(sb, i);
82 @@ -4561,7 +4561,7 @@ failed_mount:
83 remove_proc_entry(sb->s_id, ext4_proc_root);
86 - for (i = 0; i < MAXQUOTAS; i++)
87 + for (i = 0; i < EXT4_MAXQUOTAS; i++)
88 kfree(sbi->s_qf_names[i]);
90 ext4_blkdev_remove(sbi);
91 @@ -5109,7 +5109,7 @@ struct ext4_mount_options {
92 u32 s_min_batch_time, s_max_batch_time;
95 - char *s_qf_names[MAXQUOTAS];
96 + char *s_qf_names[EXT4_MAXQUOTAS];
100 @@ -5139,7 +5139,7 @@ static int ext4_remount(struct super_blo
101 old_opts.s_max_batch_time = sbi->s_max_batch_time;
103 old_opts.s_jquota_fmt = sbi->s_jquota_fmt;
104 - for (i = 0; i < MAXQUOTAS; i++)
105 + for (i = 0; i < EXT4_MAXQUOTAS; i++)
106 if (sbi->s_qf_names[i]) {
107 old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i],
109 @@ -5313,7 +5313,7 @@ static int ext4_remount(struct super_blo
112 /* Release old quota file names */
113 - for (i = 0; i < MAXQUOTAS; i++)
114 + for (i = 0; i < EXT4_MAXQUOTAS; i++)
115 kfree(old_opts.s_qf_names[i]);
117 if (sb_any_quota_suspended(sb))
118 @@ -5342,7 +5342,7 @@ restore_opts:
119 sbi->s_max_batch_time = old_opts.s_max_batch_time;
121 sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
122 - for (i = 0; i < MAXQUOTAS; i++) {
123 + for (i = 0; i < EXT4_MAXQUOTAS; i++) {
124 kfree(sbi->s_qf_names[i]);
125 sbi->s_qf_names[i] = old_opts.s_qf_names[i];
127 @@ -5580,7 +5580,7 @@ static int ext4_quota_enable(struct supe
130 struct inode *qf_inode;
131 - unsigned long qf_inums[MAXQUOTAS] = {
132 + unsigned long qf_inums[EXT4_MAXQUOTAS] = {
133 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
134 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
136 @@ -5611,13 +5611,13 @@ static int ext4_quota_enable(struct supe
137 static int ext4_enable_quotas(struct super_block *sb)
140 - unsigned long qf_inums[MAXQUOTAS] = {
141 + unsigned long qf_inums[EXT4_MAXQUOTAS] = {
142 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
143 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
146 sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
147 - for (type = 0; type < MAXQUOTAS; type++) {
148 + for (type = 0; type < EXT4_MAXQUOTAS; type++) {
149 if (qf_inums[type]) {
150 err = ext4_quota_enable(sb, type, QFMT_VFS_V1,
151 DQUOT_USAGE_ENABLED);