Commit 74abb9890dafb12a50dc140de215ed477beb1b88

Authored by Jan Kara
Committed by Linus Torvalds
1 parent 02a55ca871

quota: move function-macros from quota.h to quotaops.h

Move declarations of some macros, which should be in fact functions to
quotaops.h.  This way they can be later converted to inline functions
because we can now use declarations from quota.h.  Also add necessary
includes of quotaops.h to a few files.

[akpm@linux-foundation.org: fix JFS build]
[akpm@linux-foundation.org: fix UFS build]
[vegard.nossum@gmail.com: fix QUOTA=n build]
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Arjen Pool <arjenpool@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 8 changed files with 35 additions and 19 deletions Side-by-side Diff

... ... @@ -31,6 +31,7 @@
31 31 #include <linux/seq_file.h>
32 32 #include <linux/mount.h>
33 33 #include <linux/log2.h>
  34 +#include <linux/quotaops.h>
34 35 #include <asm/uaccess.h>
35 36 #include "ext2.h"
36 37 #include "xattr.h"
... ... @@ -22,6 +22,7 @@
22 22 #include <linux/parser.h>
23 23 #include <linux/completion.h>
24 24 #include <linux/vfs.h>
  25 +#include <linux/quotaops.h>
25 26 #include <linux/mount.h>
26 27 #include <linux/moduleparam.h>
27 28 #include <linux/kthread.h>
1 1 #include <linux/errno.h>
2 2 #include <linux/fs.h>
3 3 #include <linux/quota.h>
  4 +#include <linux/quotaops.h>
4 5 #include <linux/dqblk_v1.h>
5 6 #include <linux/quotaio_v1.h>
6 7 #include <linux/kernel.h>
... ... @@ -11,6 +11,7 @@
11 11 #include <linux/init.h>
12 12 #include <linux/module.h>
13 13 #include <linux/slab.h>
  14 +#include <linux/quotaops.h>
14 15  
15 16 #include <asm/byteorder.h>
16 17  
... ... @@ -22,6 +22,7 @@
22 22 #include <linux/blkdev.h>
23 23 #include <linux/buffer_head.h>
24 24 #include <linux/exportfs.h>
  25 +#include <linux/quotaops.h>
25 26 #include <linux/vfs.h>
26 27 #include <linux/mnt_namespace.h>
27 28 #include <linux/mount.h>
... ... @@ -76,6 +76,7 @@
76 76  
77 77 #include <linux/errno.h>
78 78 #include <linux/fs.h>
  79 +#include <linux/quotaops.h>
79 80 #include <linux/slab.h>
80 81 #include <linux/time.h>
81 82 #include <linux/stat.h>
include/linux/quota.h
... ... @@ -41,9 +41,6 @@
41 41 #define __DQUOT_VERSION__ "dquot_6.5.1"
42 42 #define __DQUOT_NUM_VERSION__ 6*10000+5*100+1
43 43  
44   -typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
45   -typedef __u64 qsize_t; /* Type in which we store sizes */
46   -
47 44 /* Size of blocks in which are counted size limits */
48 45 #define QUOTABLOCK_BITS 10
49 46 #define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
... ... @@ -172,6 +169,9 @@
172 169  
173 170 #include <asm/atomic.h>
174 171  
  172 +typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
  173 +typedef __u64 qsize_t; /* Type in which we store sizes */
  174 +
175 175 extern spinlock_t dq_data_lock;
176 176  
177 177 /* Maximal numbers of writes for quota operation (insert/delete/update)
... ... @@ -225,9 +225,6 @@
225 225 extern void mark_info_dirty(struct super_block *sb, int type);
226 226 #define info_dirty(info) test_bit(DQF_INFO_DIRTY_B, &(info)->dqi_flags)
227 227  
228   -#define sb_dqopt(sb) (&(sb)->s_dquot)
229   -#define sb_dqinfo(sb, type) (sb_dqopt(sb)->info+(type))
230   -
231 228 struct dqstats {
232 229 int lookups;
233 230 int drops;
... ... @@ -334,19 +331,6 @@
334 331 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
335 332 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
336 333 };
337   -
338   -#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
339   - (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))
340   -
341   -#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \
342   - sb_has_quota_enabled(sb, GRPQUOTA))
343   -
344   -#define sb_has_quota_suspended(sb, type) \
345   - ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
346   - (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
347   -
348   -#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \
349   - sb_has_quota_suspended(sb, GRPQUOTA))
350 334  
351 335 int register_quota_format(struct quota_format_type *fmt);
352 336 void unregister_quota_format(struct quota_format_type *fmt);
include/linux/quotaops.h
... ... @@ -14,6 +14,8 @@
14 14  
15 15 #include <linux/fs.h>
16 16  
  17 +#define sb_dqopt(sb) (&(sb)->s_dquot)
  18 +
17 19 #if defined(CONFIG_QUOTA)
18 20  
19 21 /*
20 22  
... ... @@ -52,7 +54,26 @@
52 54 int vfs_dq_transfer(struct inode *inode, struct iattr *iattr);
53 55 int vfs_dq_quota_on_remount(struct super_block *sb);
54 56  
  57 +#define sb_dqinfo(sb, type) (sb_dqopt(sb)->info+(type))
  58 +
55 59 /*
  60 + * Functions for checking status of quota
  61 + */
  62 +
  63 +#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
  64 + (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))
  65 +
  66 +#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \
  67 + sb_has_quota_enabled(sb, GRPQUOTA))
  68 +
  69 +#define sb_has_quota_suspended(sb, type) \
  70 + ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
  71 + (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
  72 +
  73 +#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \
  74 + sb_has_quota_suspended(sb, GRPQUOTA))
  75 +
  76 +/*
56 77 * Operations supported for diskquotas.
57 78 */
58 79 extern struct dquot_operations dquot_operations;
... ... @@ -158,6 +179,11 @@
158 179 }
159 180  
160 181 #else
  182 +
  183 +#define sb_has_quota_enabled(sb, type) 0
  184 +#define sb_any_quota_enabled(sb) 0
  185 +#define sb_has_quota_suspended(sb, type) 0
  186 +#define sb_any_quota_suspended(sb) 0
161 187  
162 188 /*
163 189 * NO-OP when quota not configured.