diff options
author | Jan Kara <jack@suse.cz> | 2008-07-25 04:46:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:35 -0400 |
commit | b85f4b87a511bea86dac68c4f0fabaee2cac6c4c (patch) | |
tree | 978e541e47effe07119862f04becbb4f79b02742 | |
parent | b48d380541f634663b71766005838edbb7261685 (diff) |
quota: rename quota functions from upper case, make bigger ones non-inline
Cleanup quotaops.h: Rename functions from uppercase to lowercase (and
define backward compatibility macros), move larger functions to dquot.c
and make them non-inline.
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.c | 53 | ||||
-rw-r--r-- | include/linux/quotaops.h | 226 |
2 files changed, 160 insertions, 119 deletions
diff --git a/fs/dquot.c b/fs/dquot.c index ad88cf6fcbaf..0bcaf970bbb4 100644 --- a/fs/dquot.c +++ b/fs/dquot.c | |||
@@ -1153,6 +1153,28 @@ int dquot_drop(struct inode *inode) | |||
1153 | return 0; | 1153 | return 0; |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | /* Wrapper to remove references to quota structures from inode */ | ||
1157 | void vfs_dq_drop(struct inode *inode) | ||
1158 | { | ||
1159 | /* Here we can get arbitrary inode from clear_inode() so we have | ||
1160 | * to be careful. OTOH we don't need locking as quota operations | ||
1161 | * are allowed to change only at mount time */ | ||
1162 | if (!IS_NOQUOTA(inode) && inode->i_sb && inode->i_sb->dq_op | ||
1163 | && inode->i_sb->dq_op->drop) { | ||
1164 | int cnt; | ||
1165 | /* Test before calling to rule out calls from proc and such | ||
1166 | * where we are not allowed to block. Note that this is | ||
1167 | * actually reliable test even without the lock - the caller | ||
1168 | * must assure that nobody can come after the DQUOT_DROP and | ||
1169 | * add quota pointers back anyway */ | ||
1170 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) | ||
1171 | if (inode->i_dquot[cnt] != NODQUOT) | ||
1172 | break; | ||
1173 | if (cnt < MAXQUOTAS) | ||
1174 | inode->i_sb->dq_op->drop(inode); | ||
1175 | } | ||
1176 | } | ||
1177 | |||
1156 | /* | 1178 | /* |
1157 | * Following four functions update i_blocks+i_bytes fields and | 1179 | * Following four functions update i_blocks+i_bytes fields and |
1158 | * quota information (together with appropriate checks) | 1180 | * quota information (together with appropriate checks) |
@@ -1426,6 +1448,18 @@ warn_put_all: | |||
1426 | return ret; | 1448 | return ret; |
1427 | } | 1449 | } |
1428 | 1450 | ||
1451 | /* Wrapper for transferring ownership of an inode */ | ||
1452 | int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) | ||
1453 | { | ||
1454 | if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) { | ||
1455 | vfs_dq_init(inode); | ||
1456 | if (inode->i_sb->dq_op->transfer(inode, iattr) == NO_QUOTA) | ||
1457 | return 1; | ||
1458 | } | ||
1459 | return 0; | ||
1460 | } | ||
1461 | |||
1462 | |||
1429 | /* | 1463 | /* |
1430 | * Write info of quota file to disk | 1464 | * Write info of quota file to disk |
1431 | */ | 1465 | */ |
@@ -1766,6 +1800,22 @@ out: | |||
1766 | return error; | 1800 | return error; |
1767 | } | 1801 | } |
1768 | 1802 | ||
1803 | /* Wrapper to turn on quotas when remounting rw */ | ||
1804 | int vfs_dq_quota_on_remount(struct super_block *sb) | ||
1805 | { | ||
1806 | int cnt; | ||
1807 | int ret = 0, err; | ||
1808 | |||
1809 | if (!sb->s_qcop || !sb->s_qcop->quota_on) | ||
1810 | return -ENOSYS; | ||
1811 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | ||
1812 | err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1); | ||
1813 | if (err < 0 && !ret) | ||
1814 | ret = err; | ||
1815 | } | ||
1816 | return ret; | ||
1817 | } | ||
1818 | |||
1769 | /* Generic routine for getting common part of quota structure */ | 1819 | /* Generic routine for getting common part of quota structure */ |
1770 | static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di) | 1820 | static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di) |
1771 | { | 1821 | { |
@@ -2101,8 +2151,11 @@ EXPORT_SYMBOL(dquot_release); | |||
2101 | EXPORT_SYMBOL(dquot_mark_dquot_dirty); | 2151 | EXPORT_SYMBOL(dquot_mark_dquot_dirty); |
2102 | EXPORT_SYMBOL(dquot_initialize); | 2152 | EXPORT_SYMBOL(dquot_initialize); |
2103 | EXPORT_SYMBOL(dquot_drop); | 2153 | EXPORT_SYMBOL(dquot_drop); |
2154 | EXPORT_SYMBOL(vfs_dq_drop); | ||
2104 | EXPORT_SYMBOL(dquot_alloc_space); | 2155 | EXPORT_SYMBOL(dquot_alloc_space); |
2105 | EXPORT_SYMBOL(dquot_alloc_inode); | 2156 | EXPORT_SYMBOL(dquot_alloc_inode); |
2106 | EXPORT_SYMBOL(dquot_free_space); | 2157 | EXPORT_SYMBOL(dquot_free_space); |
2107 | EXPORT_SYMBOL(dquot_free_inode); | 2158 | EXPORT_SYMBOL(dquot_free_inode); |
2108 | EXPORT_SYMBOL(dquot_transfer); | 2159 | EXPORT_SYMBOL(dquot_transfer); |
2160 | EXPORT_SYMBOL(vfs_dq_transfer); | ||
2161 | EXPORT_SYMBOL(vfs_dq_quota_on_remount); | ||
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index f86702053853..0c8f9fe462af 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -19,34 +19,38 @@ | |||
19 | /* | 19 | /* |
20 | * declaration of quota_function calls in kernel. | 20 | * declaration of quota_function calls in kernel. |
21 | */ | 21 | */ |
22 | extern void sync_dquots(struct super_block *sb, int type); | 22 | void sync_dquots(struct super_block *sb, int type); |
23 | 23 | ||
24 | extern int dquot_initialize(struct inode *inode, int type); | 24 | int dquot_initialize(struct inode *inode, int type); |
25 | extern int dquot_drop(struct inode *inode); | 25 | int dquot_drop(struct inode *inode); |
26 | 26 | ||
27 | extern int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); | 27 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); |
28 | extern int dquot_alloc_inode(const struct inode *inode, unsigned long number); | 28 | int dquot_alloc_inode(const struct inode *inode, unsigned long number); |
29 | 29 | ||
30 | extern int dquot_free_space(struct inode *inode, qsize_t number); | 30 | int dquot_free_space(struct inode *inode, qsize_t number); |
31 | extern int dquot_free_inode(const struct inode *inode, unsigned long number); | 31 | int dquot_free_inode(const struct inode *inode, unsigned long number); |
32 | 32 | ||
33 | extern int dquot_transfer(struct inode *inode, struct iattr *iattr); | 33 | int dquot_transfer(struct inode *inode, struct iattr *iattr); |
34 | extern int dquot_commit(struct dquot *dquot); | 34 | int dquot_commit(struct dquot *dquot); |
35 | extern int dquot_acquire(struct dquot *dquot); | 35 | int dquot_acquire(struct dquot *dquot); |
36 | extern int dquot_release(struct dquot *dquot); | 36 | int dquot_release(struct dquot *dquot); |
37 | extern int dquot_commit_info(struct super_block *sb, int type); | 37 | int dquot_commit_info(struct super_block *sb, int type); |
38 | extern int dquot_mark_dquot_dirty(struct dquot *dquot); | 38 | int dquot_mark_dquot_dirty(struct dquot *dquot); |
39 | 39 | ||
40 | extern int vfs_quota_on(struct super_block *sb, int type, int format_id, | 40 | int vfs_quota_on(struct super_block *sb, int type, int format_id, |
41 | char *path, int remount); | 41 | char *path, int remount); |
42 | extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, | 42 | int vfs_quota_on_mount(struct super_block *sb, char *qf_name, |
43 | int format_id, int type); | 43 | int format_id, int type); |
44 | extern int vfs_quota_off(struct super_block *sb, int type, int remount); | 44 | int vfs_quota_off(struct super_block *sb, int type, int remount); |
45 | extern int vfs_quota_sync(struct super_block *sb, int type); | 45 | int vfs_quota_sync(struct super_block *sb, int type); |
46 | extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 46 | int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
47 | extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 47 | int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
48 | extern int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | 48 | int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); |
49 | extern int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | 49 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); |
50 | |||
51 | void vfs_dq_drop(struct inode *inode); | ||
52 | int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); | ||
53 | int vfs_dq_quota_on_remount(struct super_block *sb); | ||
50 | 54 | ||
51 | /* | 55 | /* |
52 | * Operations supported for diskquotas. | 56 | * Operations supported for diskquotas. |
@@ -59,38 +63,16 @@ extern struct quotactl_ops vfs_quotactl_ops; | |||
59 | 63 | ||
60 | /* It is better to call this function outside of any transaction as it might | 64 | /* 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. */ | 65 | * need a lot of space in journal for dquot structure allocation. */ |
62 | static inline void DQUOT_INIT(struct inode *inode) | 66 | static inline void vfs_dq_init(struct inode *inode) |
63 | { | 67 | { |
64 | BUG_ON(!inode->i_sb); | 68 | BUG_ON(!inode->i_sb); |
65 | if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) | 69 | if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) |
66 | inode->i_sb->dq_op->initialize(inode, -1); | 70 | inode->i_sb->dq_op->initialize(inode, -1); |
67 | } | 71 | } |
68 | 72 | ||
69 | /* The same as with DQUOT_INIT */ | ||
70 | static inline void DQUOT_DROP(struct inode *inode) | ||
71 | { | ||
72 | /* 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 | ||
74 | * are allowed to change only at mount time */ | ||
75 | if (!IS_NOQUOTA(inode) && inode->i_sb && inode->i_sb->dq_op | ||
76 | && inode->i_sb->dq_op->drop) { | ||
77 | int cnt; | ||
78 | /* Test before calling to rule out calls from proc and such | ||
79 | * where we are not allowed to block. Note that this is | ||
80 | * actually reliable test even without the lock - the caller | ||
81 | * must assure that nobody can come after the DQUOT_DROP and | ||
82 | * add quota pointers back anyway */ | ||
83 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) | ||
84 | if (inode->i_dquot[cnt] != NODQUOT) | ||
85 | break; | ||
86 | if (cnt < MAXQUOTAS) | ||
87 | inode->i_sb->dq_op->drop(inode); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | /* The following allocation/freeing/transfer functions *must* be called inside | 73 | /* The following allocation/freeing/transfer functions *must* be called inside |
92 | * a transaction (deadlocks possible otherwise) */ | 74 | * a transaction (deadlocks possible otherwise) */ |
93 | static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 75 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) |
94 | { | 76 | { |
95 | if (sb_any_quota_enabled(inode->i_sb)) { | 77 | if (sb_any_quota_enabled(inode->i_sb)) { |
96 | /* Used space is updated in alloc_space() */ | 78 | /* Used space is updated in alloc_space() */ |
@@ -102,15 +84,15 @@ static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | |||
102 | return 0; | 84 | return 0; |
103 | } | 85 | } |
104 | 86 | ||
105 | static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) | 87 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) |
106 | { | 88 | { |
107 | int ret; | 89 | int ret; |
108 | if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr))) | 90 | if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr))) |
109 | mark_inode_dirty(inode); | 91 | mark_inode_dirty(inode); |
110 | return ret; | 92 | return ret; |
111 | } | 93 | } |
112 | 94 | ||
113 | static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 95 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) |
114 | { | 96 | { |
115 | if (sb_any_quota_enabled(inode->i_sb)) { | 97 | if (sb_any_quota_enabled(inode->i_sb)) { |
116 | /* Used space is updated in alloc_space() */ | 98 | /* Used space is updated in alloc_space() */ |
@@ -122,25 +104,25 @@ static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | |||
122 | return 0; | 104 | return 0; |
123 | } | 105 | } |
124 | 106 | ||
125 | static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) | 107 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) |
126 | { | 108 | { |
127 | int ret; | 109 | int ret; |
128 | if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr))) | 110 | if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr))) |
129 | mark_inode_dirty(inode); | 111 | mark_inode_dirty(inode); |
130 | return ret; | 112 | return ret; |
131 | } | 113 | } |
132 | 114 | ||
133 | static inline int DQUOT_ALLOC_INODE(struct inode *inode) | 115 | static inline int vfs_dq_alloc_inode(struct inode *inode) |
134 | { | 116 | { |
135 | if (sb_any_quota_enabled(inode->i_sb)) { | 117 | if (sb_any_quota_enabled(inode->i_sb)) { |
136 | DQUOT_INIT(inode); | 118 | vfs_dq_init(inode); |
137 | if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) | 119 | if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) |
138 | return 1; | 120 | return 1; |
139 | } | 121 | } |
140 | return 0; | 122 | return 0; |
141 | } | 123 | } |
142 | 124 | ||
143 | static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 125 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) |
144 | { | 126 | { |
145 | if (sb_any_quota_enabled(inode->i_sb)) | 127 | if (sb_any_quota_enabled(inode->i_sb)) |
146 | inode->i_sb->dq_op->free_space(inode, nr); | 128 | inode->i_sb->dq_op->free_space(inode, nr); |
@@ -148,35 +130,25 @@ static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | |||
148 | inode_sub_bytes(inode, nr); | 130 | inode_sub_bytes(inode, nr); |
149 | } | 131 | } |
150 | 132 | ||
151 | static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) | 133 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) |
152 | { | 134 | { |
153 | DQUOT_FREE_SPACE_NODIRTY(inode, nr); | 135 | vfs_dq_free_space_nodirty(inode, nr); |
154 | mark_inode_dirty(inode); | 136 | mark_inode_dirty(inode); |
155 | } | 137 | } |
156 | 138 | ||
157 | static inline void DQUOT_FREE_INODE(struct inode *inode) | 139 | static inline void vfs_dq_free_inode(struct inode *inode) |
158 | { | 140 | { |
159 | if (sb_any_quota_enabled(inode->i_sb)) | 141 | if (sb_any_quota_enabled(inode->i_sb)) |
160 | inode->i_sb->dq_op->free_inode(inode, 1); | 142 | inode->i_sb->dq_op->free_inode(inode, 1); |
161 | } | 143 | } |
162 | 144 | ||
163 | static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) | ||
164 | { | ||
165 | if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) { | ||
166 | DQUOT_INIT(inode); | ||
167 | if (inode->i_sb->dq_op->transfer(inode, iattr) == NO_QUOTA) | ||
168 | return 1; | ||
169 | } | ||
170 | return 0; | ||
171 | } | ||
172 | |||
173 | /* The following two functions cannot be called inside a transaction */ | 145 | /* The following two functions cannot be called inside a transaction */ |
174 | static inline void DQUOT_SYNC(struct super_block *sb) | 146 | static inline void vfs_dq_sync(struct super_block *sb) |
175 | { | 147 | { |
176 | sync_dquots(sb, -1); | 148 | sync_dquots(sb, -1); |
177 | } | 149 | } |
178 | 150 | ||
179 | static inline int DQUOT_OFF(struct super_block *sb, int remount) | 151 | static inline int vfs_dq_off(struct super_block *sb, int remount) |
180 | { | 152 | { |
181 | int ret = -ENOSYS; | 153 | int ret = -ENOSYS; |
182 | 154 | ||
@@ -185,21 +157,6 @@ static inline int DQUOT_OFF(struct super_block *sb, int remount) | |||
185 | return ret; | 157 | return ret; |
186 | } | 158 | } |
187 | 159 | ||
188 | static inline int DQUOT_ON_REMOUNT(struct super_block *sb) | ||
189 | { | ||
190 | int cnt; | ||
191 | int ret = 0, err; | ||
192 | |||
193 | if (!sb->s_qcop || !sb->s_qcop->quota_on) | ||
194 | return -ENOSYS; | ||
195 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | ||
196 | err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1); | ||
197 | if (err < 0 && !ret) | ||
198 | ret = err; | ||
199 | } | ||
200 | return ret; | ||
201 | } | ||
202 | |||
203 | #else | 160 | #else |
204 | 161 | ||
205 | /* | 162 | /* |
@@ -208,113 +165,144 @@ static inline int DQUOT_ON_REMOUNT(struct super_block *sb) | |||
208 | #define sb_dquot_ops (NULL) | 165 | #define sb_dquot_ops (NULL) |
209 | #define sb_quotactl_ops (NULL) | 166 | #define sb_quotactl_ops (NULL) |
210 | 167 | ||
211 | static inline void DQUOT_INIT(struct inode *inode) | 168 | static inline void vfs_dq_init(struct inode *inode) |
212 | { | 169 | { |
213 | } | 170 | } |
214 | 171 | ||
215 | static inline void DQUOT_DROP(struct inode *inode) | 172 | static inline void vfs_dq_drop(struct inode *inode) |
216 | { | 173 | { |
217 | } | 174 | } |
218 | 175 | ||
219 | static inline int DQUOT_ALLOC_INODE(struct inode *inode) | 176 | static inline int vfs_dq_alloc_inode(struct inode *inode) |
220 | { | 177 | { |
221 | return 0; | 178 | return 0; |
222 | } | 179 | } |
223 | 180 | ||
224 | static inline void DQUOT_FREE_INODE(struct inode *inode) | 181 | static inline void vfs_dq_free_inode(struct inode *inode) |
225 | { | 182 | { |
226 | } | 183 | } |
227 | 184 | ||
228 | static inline void DQUOT_SYNC(struct super_block *sb) | 185 | static inline void vfs_dq_sync(struct super_block *sb) |
229 | { | 186 | { |
230 | } | 187 | } |
231 | 188 | ||
232 | static inline int DQUOT_OFF(struct super_block *sb, int remount) | 189 | static inline int vfs_dq_off(struct super_block *sb, int remount) |
233 | { | 190 | { |
234 | return 0; | 191 | return 0; |
235 | } | 192 | } |
236 | 193 | ||
237 | static inline int DQUOT_ON_REMOUNT(struct super_block *sb) | 194 | static inline int vfs_dq_quota_on_remount(struct super_block *sb) |
238 | { | 195 | { |
239 | return 0; | 196 | return 0; |
240 | } | 197 | } |
241 | 198 | ||
242 | static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) | 199 | static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) |
243 | { | 200 | { |
244 | return 0; | 201 | return 0; |
245 | } | 202 | } |
246 | 203 | ||
247 | static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 204 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) |
248 | { | 205 | { |
249 | inode_add_bytes(inode, nr); | 206 | inode_add_bytes(inode, nr); |
250 | return 0; | 207 | return 0; |
251 | } | 208 | } |
252 | 209 | ||
253 | static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) | 210 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) |
254 | { | 211 | { |
255 | DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr); | 212 | vfs_dq_prealloc_space_nodirty(inode, nr); |
256 | mark_inode_dirty(inode); | 213 | mark_inode_dirty(inode); |
257 | return 0; | 214 | return 0; |
258 | } | 215 | } |
259 | 216 | ||
260 | static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 217 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) |
261 | { | 218 | { |
262 | inode_add_bytes(inode, nr); | 219 | inode_add_bytes(inode, nr); |
263 | return 0; | 220 | return 0; |
264 | } | 221 | } |
265 | 222 | ||
266 | static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) | 223 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) |
267 | { | 224 | { |
268 | DQUOT_ALLOC_SPACE_NODIRTY(inode, nr); | 225 | vfs_dq_alloc_space_nodirty(inode, nr); |
269 | mark_inode_dirty(inode); | 226 | mark_inode_dirty(inode); |
270 | return 0; | 227 | return 0; |
271 | } | 228 | } |
272 | 229 | ||
273 | static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 230 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) |
274 | { | 231 | { |
275 | inode_sub_bytes(inode, nr); | 232 | inode_sub_bytes(inode, nr); |
276 | } | 233 | } |
277 | 234 | ||
278 | static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) | 235 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) |
279 | { | 236 | { |
280 | DQUOT_FREE_SPACE_NODIRTY(inode, nr); | 237 | vfs_dq_free_space_nodirty(inode, nr); |
281 | mark_inode_dirty(inode); | 238 | mark_inode_dirty(inode); |
282 | } | 239 | } |
283 | 240 | ||
284 | #endif /* CONFIG_QUOTA */ | 241 | #endif /* CONFIG_QUOTA */ |
285 | 242 | ||
286 | static inline int DQUOT_PREALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) | 243 | static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr) |
287 | { | 244 | { |
288 | return DQUOT_PREALLOC_SPACE_NODIRTY(inode, | 245 | return vfs_dq_prealloc_space_nodirty(inode, |
289 | nr << inode->i_sb->s_blocksize_bits); | 246 | nr << inode->i_sb->s_blocksize_bits); |
290 | } | 247 | } |
291 | 248 | ||
292 | static inline int DQUOT_PREALLOC_BLOCK(struct inode *inode, qsize_t nr) | 249 | static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr) |
293 | { | 250 | { |
294 | return DQUOT_PREALLOC_SPACE(inode, | 251 | return vfs_dq_prealloc_space(inode, |
295 | nr << inode->i_sb->s_blocksize_bits); | 252 | nr << inode->i_sb->s_blocksize_bits); |
296 | } | 253 | } |
297 | 254 | ||
298 | static inline int DQUOT_ALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) | 255 | static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr) |
299 | { | 256 | { |
300 | return DQUOT_ALLOC_SPACE_NODIRTY(inode, | 257 | return vfs_dq_alloc_space_nodirty(inode, |
301 | nr << inode->i_sb->s_blocksize_bits); | 258 | nr << inode->i_sb->s_blocksize_bits); |
302 | } | 259 | } |
303 | 260 | ||
304 | static inline int DQUOT_ALLOC_BLOCK(struct inode *inode, qsize_t nr) | 261 | static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr) |
305 | { | 262 | { |
306 | return DQUOT_ALLOC_SPACE(inode, | 263 | return vfs_dq_alloc_space(inode, |
307 | nr << inode->i_sb->s_blocksize_bits); | 264 | nr << inode->i_sb->s_blocksize_bits); |
308 | } | 265 | } |
309 | 266 | ||
310 | static inline void DQUOT_FREE_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) | 267 | static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) |
311 | { | 268 | { |
312 | DQUOT_FREE_SPACE_NODIRTY(inode, nr << inode->i_sb->s_blocksize_bits); | 269 | vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits); |
313 | } | 270 | } |
314 | 271 | ||
315 | static inline void DQUOT_FREE_BLOCK(struct inode *inode, qsize_t nr) | 272 | static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) |
316 | { | 273 | { |
317 | DQUOT_FREE_SPACE(inode, nr << inode->i_sb->s_blocksize_bits); | 274 | vfs_dq_free_space(inode, nr << inode->i_sb->s_blocksize_bits); |
318 | } | 275 | } |
319 | 276 | ||
277 | /* | ||
278 | * Define uppercase equivalents for compatibility with old function names | ||
279 | * Can go away when we think all users have been converted (15/04/2008) | ||
280 | */ | ||
281 | #define DQUOT_INIT(inode) vfs_dq_init(inode) | ||
282 | #define DQUOT_DROP(inode) vfs_dq_drop(inode) | ||
283 | #define DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr) \ | ||
284 | vfs_dq_prealloc_space_nodirty(inode, nr) | ||
285 | #define DQUOT_PREALLOC_SPACE(inode, nr) vfs_dq_prealloc_space(inode, nr) | ||
286 | #define DQUOT_ALLOC_SPACE_NODIRTY(inode, nr) \ | ||
287 | vfs_dq_alloc_space_nodirty(inode, nr) | ||
288 | #define DQUOT_ALLOC_SPACE(inode, nr) vfs_dq_alloc_space(inode, nr) | ||
289 | #define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) \ | ||
290 | vfs_dq_prealloc_block_nodirty(inode, nr) | ||
291 | #define DQUOT_PREALLOC_BLOCK(inode, nr) vfs_dq_prealloc_block(inode, nr) | ||
292 | #define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) \ | ||
293 | vfs_dq_alloc_block_nodirty(inode, nr) | ||
294 | #define DQUOT_ALLOC_BLOCK(inode, nr) vfs_dq_alloc_block(inode, nr) | ||
295 | #define DQUOT_ALLOC_INODE(inode) vfs_dq_alloc_inode(inode) | ||
296 | #define DQUOT_FREE_SPACE_NODIRTY(inode, nr) \ | ||
297 | vfs_dq_free_space_nodirty(inode, nr) | ||
298 | #define DQUOT_FREE_SPACE(inode, nr) vfs_dq_free_space(inode, nr) | ||
299 | #define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) \ | ||
300 | vfs_dq_free_block_nodirty(inode, nr) | ||
301 | #define DQUOT_FREE_BLOCK(inode, nr) vfs_dq_free_block(inode, nr) | ||
302 | #define DQUOT_FREE_INODE(inode) vfs_dq_free_inode(inode) | ||
303 | #define DQUOT_TRANSFER(inode, iattr) vfs_dq_transfer(inode, iattr) | ||
304 | #define DQUOT_SYNC(sb) vfs_dq_sync(sb) | ||
305 | #define DQUOT_OFF(sb, remount) vfs_dq_off(sb, remount) | ||
306 | #define DQUOT_ON_REMOUNT(sb) vfs_dq_quota_on_remount(sb) | ||
307 | |||
320 | #endif /* _LINUX_QUOTAOPS_ */ | 308 | #endif /* _LINUX_QUOTAOPS_ */ |