aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-04-28 05:14:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:33 -0400
commit03f6e92bdd467aed9d7571a571868563ae6ad288 (patch)
treeb10ba6373ffeb0d929ec9004faafcc0ac64103c0
parent8794b5b246cf6f67baf57bd9db386e79ca5cac33 (diff)
quota: various style cleanups
Cleanups in quota code: Change __inline__ to inline. Change some macros to inline functions. Remove vfs_quota_off_mount() macro. DQUOT_OFF() should be (0) is CONFIG_QUOTA is disabled. Move declaration of mark_dquot_dirty and dirty_dquot from quota.h to dquot.c [akpm@linux-foundation.org: coding-style fixes] 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>
-rw-r--r--fs/dquot.c10
-rw-r--r--fs/reiserfs/super.c2
-rw-r--r--include/linux/quota.h5
-rw-r--r--include/linux/quotaops.h71
4 files changed, 60 insertions, 28 deletions
diff --git a/fs/dquot.c b/fs/dquot.c
index 24eef582d2a0..fc26d1097d3c 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -289,7 +289,15 @@ static void wait_on_dquot(struct dquot *dquot)
289 mutex_unlock(&dquot->dq_lock); 289 mutex_unlock(&dquot->dq_lock);
290} 290}
291 291
292#define mark_dquot_dirty(dquot) ((dquot)->dq_sb->dq_op->mark_dirty(dquot)) 292static inline int dquot_dirty(struct dquot *dquot)
293{
294 return test_bit(DQ_MOD_B, &dquot->dq_flags);
295}
296
297static inline int mark_dquot_dirty(struct dquot *dquot)
298{
299 return dquot->dq_sb->dq_op->mark_dirty(dquot);
300}
293 301
294int dquot_mark_dquot_dirty(struct dquot *dquot) 302int dquot_mark_dquot_dirty(struct dquot *dquot)
295{ 303{
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 393cc22c1717..3e1972d31e44 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -304,7 +304,7 @@ static int finish_unfinished(struct super_block *s)
304 /* Turn quotas off */ 304 /* Turn quotas off */
305 for (i = 0; i < MAXQUOTAS; i++) { 305 for (i = 0; i < MAXQUOTAS; i++) {
306 if (sb_dqopt(s)->files[i]) 306 if (sb_dqopt(s)->files[i])
307 vfs_quota_off_mount(s, i); 307 vfs_quota_off(s, i);
308 } 308 }
309 if (ms_active_set) 309 if (ms_active_set)
310 /* Restore the flag back */ 310 /* Restore the flag back */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 326cb80e3867..48556b039b1c 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -331,11 +331,6 @@ struct quota_info {
331 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ 331 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
332}; 332};
333 333
334/* Inline would be better but we need to dereference super_block which is not defined yet */
335int mark_dquot_dirty(struct dquot *dquot);
336
337#define dquot_dirty(dquot) test_bit(DQ_MOD_B, &(dquot)->dq_flags)
338
339#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \ 334#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
340 (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED)) 335 (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))
341 336
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 5110201a4159..1aac25511f07 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -41,7 +41,6 @@ extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *p
41extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 41extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
42 int format_id, int type); 42 int format_id, int type);
43extern int vfs_quota_off(struct super_block *sb, int type); 43extern int vfs_quota_off(struct super_block *sb, int type);
44#define vfs_quota_off_mount(sb, type) vfs_quota_off(sb, type)
45extern int vfs_quota_sync(struct super_block *sb, int type); 44extern int vfs_quota_sync(struct super_block *sb, int type);
46extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 45extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
47extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 46extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
@@ -59,7 +58,7 @@ extern struct quotactl_ops vfs_quotactl_ops;
59 58
60/* It is better to call this function outside of any transaction as it might 59/* It is better to call this function outside of any transaction as it might
61 * need a lot of space in journal for dquot structure allocation. */ 60 * need a lot of space in journal for dquot structure allocation. */
62static __inline__ void DQUOT_INIT(struct inode *inode) 61static inline void DQUOT_INIT(struct inode *inode)
63{ 62{
64 BUG_ON(!inode->i_sb); 63 BUG_ON(!inode->i_sb);
65 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) 64 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode))
@@ -67,7 +66,7 @@ static __inline__ void DQUOT_INIT(struct inode *inode)
67} 66}
68 67
69/* The same as with DQUOT_INIT */ 68/* The same as with DQUOT_INIT */
70static __inline__ void DQUOT_DROP(struct inode *inode) 69static inline void DQUOT_DROP(struct inode *inode)
71{ 70{
72 /* Here we can get arbitrary inode from clear_inode() so we have 71 /* Here we can get arbitrary inode from clear_inode() so we have
73 * to be careful. OTOH we don't need locking as quota operations 72 * to be careful. OTOH we don't need locking as quota operations
@@ -90,7 +89,7 @@ static __inline__ void DQUOT_DROP(struct inode *inode)
90 89
91/* The following allocation/freeing/transfer functions *must* be called inside 90/* The following allocation/freeing/transfer functions *must* be called inside
92 * a transaction (deadlocks possible otherwise) */ 91 * a transaction (deadlocks possible otherwise) */
93static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 92static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
94{ 93{
95 if (sb_any_quota_enabled(inode->i_sb)) { 94 if (sb_any_quota_enabled(inode->i_sb)) {
96 /* Used space is updated in alloc_space() */ 95 /* Used space is updated in alloc_space() */
@@ -102,7 +101,7 @@ static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t
102 return 0; 101 return 0;
103} 102}
104 103
105static __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) 104static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
106{ 105{
107 int ret; 106 int ret;
108 if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr))) 107 if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr)))
@@ -110,7 +109,7 @@ static __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
110 return ret; 109 return ret;
111} 110}
112 111
113static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 112static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
114{ 113{
115 if (sb_any_quota_enabled(inode->i_sb)) { 114 if (sb_any_quota_enabled(inode->i_sb)) {
116 /* Used space is updated in alloc_space() */ 115 /* Used space is updated in alloc_space() */
@@ -122,7 +121,7 @@ static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
122 return 0; 121 return 0;
123} 122}
124 123
125static __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) 124static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
126{ 125{
127 int ret; 126 int ret;
128 if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr))) 127 if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr)))
@@ -130,7 +129,7 @@ static __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
130 return ret; 129 return ret;
131} 130}
132 131
133static __inline__ int DQUOT_ALLOC_INODE(struct inode *inode) 132static inline int DQUOT_ALLOC_INODE(struct inode *inode)
134{ 133{
135 if (sb_any_quota_enabled(inode->i_sb)) { 134 if (sb_any_quota_enabled(inode->i_sb)) {
136 DQUOT_INIT(inode); 135 DQUOT_INIT(inode);
@@ -140,7 +139,7 @@ static __inline__ int DQUOT_ALLOC_INODE(struct inode *inode)
140 return 0; 139 return 0;
141} 140}
142 141
143static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 142static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
144{ 143{
145 if (sb_any_quota_enabled(inode->i_sb)) 144 if (sb_any_quota_enabled(inode->i_sb))
146 inode->i_sb->dq_op->free_space(inode, nr); 145 inode->i_sb->dq_op->free_space(inode, nr);
@@ -148,19 +147,19 @@ static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
148 inode_sub_bytes(inode, nr); 147 inode_sub_bytes(inode, nr);
149} 148}
150 149
151static __inline__ void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) 150static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
152{ 151{
153 DQUOT_FREE_SPACE_NODIRTY(inode, nr); 152 DQUOT_FREE_SPACE_NODIRTY(inode, nr);
154 mark_inode_dirty(inode); 153 mark_inode_dirty(inode);
155} 154}
156 155
157static __inline__ void DQUOT_FREE_INODE(struct inode *inode) 156static inline void DQUOT_FREE_INODE(struct inode *inode)
158{ 157{
159 if (sb_any_quota_enabled(inode->i_sb)) 158 if (sb_any_quota_enabled(inode->i_sb))
160 inode->i_sb->dq_op->free_inode(inode, 1); 159 inode->i_sb->dq_op->free_inode(inode, 1);
161} 160}
162 161
163static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) 162static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
164{ 163{
165 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) { 164 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) {
166 DQUOT_INIT(inode); 165 DQUOT_INIT(inode);
@@ -171,9 +170,12 @@ static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
171} 170}
172 171
173/* The following two functions cannot be called inside a transaction */ 172/* The following two functions cannot be called inside a transaction */
174#define DQUOT_SYNC(sb) sync_dquots(sb, -1) 173static inline void DQUOT_SYNC(struct super_block *sb)
174{
175 sync_dquots(sb, -1);
176}
175 177
176static __inline__ int DQUOT_OFF(struct super_block *sb) 178static inline int DQUOT_OFF(struct super_block *sb)
177{ 179{
178 int ret = -ENOSYS; 180 int ret = -ENOSYS;
179 181
@@ -194,7 +196,7 @@ static __inline__ int DQUOT_OFF(struct super_block *sb)
194#define DQUOT_ALLOC_INODE(inode) (0) 196#define DQUOT_ALLOC_INODE(inode) (0)
195#define DQUOT_FREE_INODE(inode) do { } while(0) 197#define DQUOT_FREE_INODE(inode) do { } while(0)
196#define DQUOT_SYNC(sb) do { } while(0) 198#define DQUOT_SYNC(sb) do { } while(0)
197#define DQUOT_OFF(sb) do { } while(0) 199#define DQUOT_OFF(sb) (0)
198#define DQUOT_TRANSFER(inode, iattr) (0) 200#define DQUOT_TRANSFER(inode, iattr) (0)
199static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 201static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
200{ 202{
@@ -235,11 +237,38 @@ static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
235 237
236#endif /* CONFIG_QUOTA */ 238#endif /* CONFIG_QUOTA */
237 239
238#define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) DQUOT_PREALLOC_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 240static inline int DQUOT_PREALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
239#define DQUOT_PREALLOC_BLOCK(inode, nr) DQUOT_PREALLOC_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 241{
240#define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) DQUOT_ALLOC_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 242 return DQUOT_PREALLOC_SPACE_NODIRTY(inode,
241#define DQUOT_ALLOC_BLOCK(inode, nr) DQUOT_ALLOC_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 243 nr << inode->i_sb->s_blocksize_bits);
242#define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) DQUOT_FREE_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 244}
243#define DQUOT_FREE_BLOCK(inode, nr) DQUOT_FREE_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 245
246static inline int DQUOT_PREALLOC_BLOCK(struct inode *inode, qsize_t nr)
247{
248 return DQUOT_PREALLOC_SPACE(inode,
249 nr << inode->i_sb->s_blocksize_bits);
250}
251
252static inline int DQUOT_ALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
253{
254 return DQUOT_ALLOC_SPACE_NODIRTY(inode,
255 nr << inode->i_sb->s_blocksize_bits);
256}
257
258static inline int DQUOT_ALLOC_BLOCK(struct inode *inode, qsize_t nr)
259{
260 return DQUOT_ALLOC_SPACE(inode,
261 nr << inode->i_sb->s_blocksize_bits);
262}
263
264static inline void DQUOT_FREE_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
265{
266 DQUOT_FREE_SPACE_NODIRTY(inode, nr << inode->i_sb->s_blocksize_bits);
267}
268
269static inline void DQUOT_FREE_BLOCK(struct inode *inode, qsize_t nr)
270{
271 DQUOT_FREE_SPACE(inode, nr << inode->i_sb->s_blocksize_bits);
272}
244 273
245#endif /* _LINUX_QUOTAOPS_ */ 274#endif /* _LINUX_QUOTAOPS_ */