Fix missing static function declaration
[ext4-patch-queue.git] / dont-use-MAXQUOTAS-value
blobfeba2edc69bd9ddd79a6569add768830f09ea7aa
1 ext4: don't use MAXQUOTAS value
3 From: Jan Kara <jack@suse.cz>
5 MAXQUOTAS value defines maximum number of quota types VFS supports.
6 This isn't necessarily the number of types ext4 supports. Although
7 ext4 will support project quotas, use ext4 private definition for
8 consistency with other filesystems.
10 Signed-off-by: Jan Kara <jack@suse.cz>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 ---
13  fs/ext4/ext4.h      |  5 ++++-
14  fs/ext4/ext4_jbd2.h |  6 +++---
15  fs/ext4/super.c     | 22 +++++++++++-----------
16  3 files changed, 18 insertions(+), 15 deletions(-)
18 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
19 index b0c225cdb52c..1da22717ecdb 100644
20 --- a/fs/ext4/ext4.h
21 +++ b/fs/ext4/ext4.h
22 @@ -1174,6 +1174,9 @@ struct ext4_super_block {
23  #define EXT4_MF_MNTDIR_SAMPLED 0x0001
24  #define EXT4_MF_FS_ABORTED     0x0002  /* Fatal error detected */
26 +/* Number of quota types we support */
27 +#define EXT4_MAXQUOTAS 2
29  /*
30   * fourth extended-fs super-block data in memory
31   */
32 @@ -1237,7 +1240,7 @@ struct ext4_sb_info {
33         u32 s_min_batch_time;
34         struct block_device *journal_bdev;
35  #ifdef CONFIG_QUOTA
36 -       char *s_qf_names[MAXQUOTAS];            /* Names of quota files with journalled quota */
37 +       char *s_qf_names[EXT4_MAXQUOTAS];       /* Names of quota files with journalled quota */
38         int s_jquota_fmt;                       /* Format of quota to use */
39  #endif
40         unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
41 diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
42 index 17c00ff202f2..9c5b49fb281e 100644
43 --- a/fs/ext4/ext4_jbd2.h
44 +++ b/fs/ext4/ext4_jbd2.h
45 @@ -102,9 +102,9 @@
46  #define EXT4_QUOTA_INIT_BLOCKS(sb) 0
47  #define EXT4_QUOTA_DEL_BLOCKS(sb) 0
48  #endif
49 -#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
50 -#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
51 -#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
52 +#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
53 +#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
54 +#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
56  static inline int ext4_jbd2_credits_xattr(struct inode *inode)
57  {
58 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
59 index 0b28b36e7915..baa73b798f8b 100644
60 --- a/fs/ext4/super.c
61 +++ b/fs/ext4/super.c
62 @@ -823,7 +823,7 @@ static void ext4_put_super(struct super_block *sb)
63         percpu_counter_destroy(&sbi->s_extent_cache_cnt);
64         brelse(sbi->s_sbh);
65  #ifdef CONFIG_QUOTA
66 -       for (i = 0; i < MAXQUOTAS; i++)
67 +       for (i = 0; i < EXT4_MAXQUOTAS; i++)
68                 kfree(sbi->s_qf_names[i]);
69  #endif
71 @@ -2207,7 +2207,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
72         /* Needed for iput() to work correctly and not trash data */
73         sb->s_flags |= MS_ACTIVE;
74         /* Turn on quotas so that they are updated correctly */
75 -       for (i = 0; i < MAXQUOTAS; i++) {
76 +       for (i = 0; i < EXT4_MAXQUOTAS; i++) {
77                 if (EXT4_SB(sb)->s_qf_names[i]) {
78                         int ret = ext4_quota_on_mount(sb, i);
79                         if (ret < 0)
80 @@ -2263,7 +2263,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
81                        PLURAL(nr_truncates));
82  #ifdef CONFIG_QUOTA
83         /* Turn quotas off */
84 -       for (i = 0; i < MAXQUOTAS; i++) {
85 +       for (i = 0; i < EXT4_MAXQUOTAS; i++) {
86                 if (sb_dqopt(sb)->files[i])
87                         dquot_quota_off(sb, i);
88         }
89 @@ -4243,7 +4243,7 @@ failed_mount:
90                 remove_proc_entry(sb->s_id, ext4_proc_root);
91         }
92  #ifdef CONFIG_QUOTA
93 -       for (i = 0; i < MAXQUOTAS; i++)
94 +       for (i = 0; i < EXT4_MAXQUOTAS; i++)
95                 kfree(sbi->s_qf_names[i]);
96  #endif
97         ext4_blkdev_remove(sbi);
98 @@ -4770,7 +4770,7 @@ struct ext4_mount_options {
99         u32 s_min_batch_time, s_max_batch_time;
100  #ifdef CONFIG_QUOTA
101         int s_jquota_fmt;
102 -       char *s_qf_names[MAXQUOTAS];
103 +       char *s_qf_names[EXT4_MAXQUOTAS];
104  #endif
105  };
107 @@ -4800,7 +4800,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
108         old_opts.s_max_batch_time = sbi->s_max_batch_time;
109  #ifdef CONFIG_QUOTA
110         old_opts.s_jquota_fmt = sbi->s_jquota_fmt;
111 -       for (i = 0; i < MAXQUOTAS; i++)
112 +       for (i = 0; i < EXT4_MAXQUOTAS; i++)
113                 if (sbi->s_qf_names[i]) {
114                         old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i],
115                                                          GFP_KERNEL);
116 @@ -4961,7 +4961,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
118  #ifdef CONFIG_QUOTA
119         /* Release old quota file names */
120 -       for (i = 0; i < MAXQUOTAS; i++)
121 +       for (i = 0; i < EXT4_MAXQUOTAS; i++)
122                 kfree(old_opts.s_qf_names[i]);
123         if (enable_quota) {
124                 if (sb_any_quota_suspended(sb))
125 @@ -4990,7 +4990,7 @@ restore_opts:
126         sbi->s_max_batch_time = old_opts.s_max_batch_time;
127  #ifdef CONFIG_QUOTA
128         sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
129 -       for (i = 0; i < MAXQUOTAS; i++) {
130 +       for (i = 0; i < EXT4_MAXQUOTAS; i++) {
131                 kfree(sbi->s_qf_names[i]);
132                 sbi->s_qf_names[i] = old_opts.s_qf_names[i];
133         }
134 @@ -5193,7 +5193,7 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
136         int err;
137         struct inode *qf_inode;
138 -       unsigned long qf_inums[MAXQUOTAS] = {
139 +       unsigned long qf_inums[EXT4_MAXQUOTAS] = {
140                 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
141                 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
142         };
143 @@ -5221,13 +5221,13 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
144  static int ext4_enable_quotas(struct super_block *sb)
146         int type, err = 0;
147 -       unsigned long qf_inums[MAXQUOTAS] = {
148 +       unsigned long qf_inums[EXT4_MAXQUOTAS] = {
149                 le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
150                 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
151         };
153         sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
154 -       for (type = 0; type < MAXQUOTAS; type++) {
155 +       for (type = 0; type < EXT4_MAXQUOTAS; type++) {
156                 if (qf_inums[type]) {
157                         err = ext4_quota_enable(sb, type, QFMT_VFS_V1,
158                                                 DQUOT_USAGE_ENABLED);
159 -- 
160 1.8.1.4