aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/quotaops.h
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 /include/linux/quotaops.h
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>
Diffstat (limited to 'include/linux/quotaops.h')
-rw-r--r--include/linux/quotaops.h71
1 files changed, 50 insertions, 21 deletions
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_ */