aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-07-25 04:46:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:35 -0400
commit03b063436ca1076301de58d9d628f610ab5404ad (patch)
treec0c21837706d6c462cef3183f5e514405d1af993 /include
parent74abb9890dafb12a50dc140de215ed477beb1b88 (diff)
quota: convert macros to inline functions
Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/quota.h5
-rw-r--r--include/linux/quotaops.h65
2 files changed, 53 insertions, 17 deletions
diff --git a/include/linux/quota.h b/include/linux/quota.h
index f9983ea0ff88..4e004fef8134 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -223,7 +223,10 @@ struct super_block;
223#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */ 223#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */
224 224
225extern void mark_info_dirty(struct super_block *sb, int type); 225extern void mark_info_dirty(struct super_block *sb, int type);
226#define info_dirty(info) test_bit(DQF_INFO_DIRTY_B, &(info)->dqi_flags) 226static inline int info_dirty(struct mem_dqinfo *info)
227{
228 return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags);
229}
227 230
228struct dqstats { 231struct dqstats {
229 int lookups; 232 int lookups;
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 38218c1334b1..742187f7a05c 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -11,10 +11,12 @@
11#define _LINUX_QUOTAOPS_ 11#define _LINUX_QUOTAOPS_
12 12
13#include <linux/smp_lock.h> 13#include <linux/smp_lock.h>
14
15#include <linux/fs.h> 14#include <linux/fs.h>
16 15
17#define sb_dqopt(sb) (&(sb)->s_dquot) 16static inline struct quota_info *sb_dqopt(struct super_block *sb)
17{
18 return &sb->s_dquot;
19}
18 20
19#if defined(CONFIG_QUOTA) 21#if defined(CONFIG_QUOTA)
20 22
@@ -54,24 +56,40 @@ void vfs_dq_drop(struct inode *inode);
54int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); 56int vfs_dq_transfer(struct inode *inode, struct iattr *iattr);
55int vfs_dq_quota_on_remount(struct super_block *sb); 57int vfs_dq_quota_on_remount(struct super_block *sb);
56 58
57#define sb_dqinfo(sb, type) (sb_dqopt(sb)->info+(type)) 59static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
60{
61 return sb_dqopt(sb)->info + type;
62}
58 63
59/* 64/*
60 * Functions for checking status of quota 65 * Functions for checking status of quota
61 */ 66 */
62 67
63#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \ 68static inline int sb_has_quota_enabled(struct super_block *sb, int type)
64 (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED)) 69{
70 if (type == USRQUOTA)
71 return sb_dqopt(sb)->flags & DQUOT_USR_ENABLED;
72 return sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED;
73}
65 74
66#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \ 75static inline int sb_any_quota_enabled(struct super_block *sb)
67 sb_has_quota_enabled(sb, GRPQUOTA)) 76{
77 return sb_has_quota_enabled(sb, USRQUOTA) ||
78 sb_has_quota_enabled(sb, GRPQUOTA);
79}
68 80
69#define sb_has_quota_suspended(sb, type) \ 81static inline int sb_has_quota_suspended(struct super_block *sb, int type)
70 ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \ 82{
71 (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED)) 83 if (type == USRQUOTA)
84 return sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED;
85 return sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED;
86}
72 87
73#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \ 88static inline int sb_any_quota_suspended(struct super_block *sb)
74 sb_has_quota_suspended(sb, GRPQUOTA)) 89{
90 return sb_has_quota_suspended(sb, USRQUOTA) ||
91 sb_has_quota_suspended(sb, GRPQUOTA);
92}
75 93
76/* 94/*
77 * Operations supported for diskquotas. 95 * Operations supported for diskquotas.
@@ -180,10 +198,25 @@ static inline int vfs_dq_off(struct super_block *sb, int remount)
180 198
181#else 199#else
182 200
183#define sb_has_quota_enabled(sb, type) 0 201static inline int sb_has_quota_enabled(struct super_block *sb, int type)
184#define sb_any_quota_enabled(sb) 0 202{
185#define sb_has_quota_suspended(sb, type) 0 203 return 0;
186#define sb_any_quota_suspended(sb) 0 204}
205
206static inline int sb_any_quota_enabled(struct super_block *sb)
207{
208 return 0;
209}
210
211static inline int sb_has_quota_suspended(struct super_block *sb, int type)
212{
213 return 0;
214}
215
216static inline int sb_any_quota_suspended(struct super_block *sb)
217{
218 return 0;
219}
187 220
188/* 221/*
189 * NO-OP when quota not configured. 222 * NO-OP when quota not configured.