diff options
Diffstat (limited to 'include/linux/quotaops.h')
-rw-r--r-- | include/linux/quotaops.h | 96 |
1 files changed, 76 insertions, 20 deletions
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index a558a4c1d35a..21b781a3350f 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -24,12 +24,21 @@ void sync_dquots(struct super_block *sb, int type); | |||
24 | 24 | ||
25 | int dquot_initialize(struct inode *inode, int type); | 25 | int dquot_initialize(struct inode *inode, int type); |
26 | int dquot_drop(struct inode *inode); | 26 | int dquot_drop(struct inode *inode); |
27 | int dquot_drop_locked(struct inode *inode); | ||
28 | struct dquot *dqget(struct super_block *sb, unsigned int id, int type); | ||
29 | void dqput(struct dquot *dquot); | ||
30 | int dquot_is_cached(struct super_block *sb, unsigned int id, int type); | ||
31 | int dquot_scan_active(struct super_block *sb, | ||
32 | int (*fn)(struct dquot *dquot, unsigned long priv), | ||
33 | unsigned long priv); | ||
34 | struct dquot *dquot_alloc(struct super_block *sb, int type); | ||
35 | void dquot_destroy(struct dquot *dquot); | ||
27 | 36 | ||
28 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); | 37 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); |
29 | int dquot_alloc_inode(const struct inode *inode, unsigned long number); | 38 | int dquot_alloc_inode(const struct inode *inode, qsize_t number); |
30 | 39 | ||
31 | int dquot_free_space(struct inode *inode, qsize_t number); | 40 | int dquot_free_space(struct inode *inode, qsize_t number); |
32 | int dquot_free_inode(const struct inode *inode, unsigned long number); | 41 | int dquot_free_inode(const struct inode *inode, qsize_t number); |
33 | 42 | ||
34 | int dquot_transfer(struct inode *inode, struct iattr *iattr); | 43 | int dquot_transfer(struct inode *inode, struct iattr *iattr); |
35 | int dquot_commit(struct dquot *dquot); | 44 | int dquot_commit(struct dquot *dquot); |
@@ -40,11 +49,14 @@ int dquot_mark_dquot_dirty(struct dquot *dquot); | |||
40 | 49 | ||
41 | int vfs_quota_on(struct super_block *sb, int type, int format_id, | 50 | int vfs_quota_on(struct super_block *sb, int type, int format_id, |
42 | char *path, int remount); | 51 | char *path, int remount); |
52 | int vfs_quota_enable(struct inode *inode, int type, int format_id, | ||
53 | unsigned int flags); | ||
43 | int vfs_quota_on_path(struct super_block *sb, int type, int format_id, | 54 | int vfs_quota_on_path(struct super_block *sb, int type, int format_id, |
44 | struct path *path); | 55 | struct path *path); |
45 | int vfs_quota_on_mount(struct super_block *sb, char *qf_name, | 56 | int vfs_quota_on_mount(struct super_block *sb, char *qf_name, |
46 | int format_id, int type); | 57 | int format_id, int type); |
47 | int vfs_quota_off(struct super_block *sb, int type, int remount); | 58 | int vfs_quota_off(struct super_block *sb, int type, int remount); |
59 | int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags); | ||
48 | int vfs_quota_sync(struct super_block *sb, int type); | 60 | int vfs_quota_sync(struct super_block *sb, int type); |
49 | int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 61 | int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
50 | int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 62 | int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
@@ -64,24 +76,22 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) | |||
64 | * Functions for checking status of quota | 76 | * Functions for checking status of quota |
65 | */ | 77 | */ |
66 | 78 | ||
67 | static inline int sb_has_quota_enabled(struct super_block *sb, int type) | 79 | static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type) |
68 | { | 80 | { |
69 | if (type == USRQUOTA) | 81 | return sb_dqopt(sb)->flags & |
70 | return sb_dqopt(sb)->flags & DQUOT_USR_ENABLED; | 82 | dquot_state_flag(DQUOT_USAGE_ENABLED, type); |
71 | return sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED; | ||
72 | } | 83 | } |
73 | 84 | ||
74 | static inline int sb_any_quota_enabled(struct super_block *sb) | 85 | static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type) |
75 | { | 86 | { |
76 | return sb_has_quota_enabled(sb, USRQUOTA) || | 87 | return sb_dqopt(sb)->flags & |
77 | sb_has_quota_enabled(sb, GRPQUOTA); | 88 | dquot_state_flag(DQUOT_LIMITS_ENABLED, type); |
78 | } | 89 | } |
79 | 90 | ||
80 | static inline int sb_has_quota_suspended(struct super_block *sb, int type) | 91 | static inline int sb_has_quota_suspended(struct super_block *sb, int type) |
81 | { | 92 | { |
82 | if (type == USRQUOTA) | 93 | return sb_dqopt(sb)->flags & |
83 | return sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED; | 94 | dquot_state_flag(DQUOT_SUSPENDED, type); |
84 | return sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED; | ||
85 | } | 95 | } |
86 | 96 | ||
87 | static inline int sb_any_quota_suspended(struct super_block *sb) | 97 | static inline int sb_any_quota_suspended(struct super_block *sb) |
@@ -90,6 +100,31 @@ static inline int sb_any_quota_suspended(struct super_block *sb) | |||
90 | sb_has_quota_suspended(sb, GRPQUOTA); | 100 | sb_has_quota_suspended(sb, GRPQUOTA); |
91 | } | 101 | } |
92 | 102 | ||
103 | /* Does kernel know about any quota information for given sb + type? */ | ||
104 | static inline int sb_has_quota_loaded(struct super_block *sb, int type) | ||
105 | { | ||
106 | /* Currently if anything is on, then quota usage is on as well */ | ||
107 | return sb_has_quota_usage_enabled(sb, type); | ||
108 | } | ||
109 | |||
110 | static inline int sb_any_quota_loaded(struct super_block *sb) | ||
111 | { | ||
112 | return sb_has_quota_loaded(sb, USRQUOTA) || | ||
113 | sb_has_quota_loaded(sb, GRPQUOTA); | ||
114 | } | ||
115 | |||
116 | static inline int sb_has_quota_active(struct super_block *sb, int type) | ||
117 | { | ||
118 | return sb_has_quota_loaded(sb, type) && | ||
119 | !sb_has_quota_suspended(sb, type); | ||
120 | } | ||
121 | |||
122 | static inline int sb_any_quota_active(struct super_block *sb) | ||
123 | { | ||
124 | return sb_has_quota_active(sb, USRQUOTA) || | ||
125 | sb_has_quota_active(sb, GRPQUOTA); | ||
126 | } | ||
127 | |||
93 | /* | 128 | /* |
94 | * Operations supported for diskquotas. | 129 | * Operations supported for diskquotas. |
95 | */ | 130 | */ |
@@ -104,7 +139,7 @@ extern struct quotactl_ops vfs_quotactl_ops; | |||
104 | static inline void vfs_dq_init(struct inode *inode) | 139 | static inline void vfs_dq_init(struct inode *inode) |
105 | { | 140 | { |
106 | BUG_ON(!inode->i_sb); | 141 | BUG_ON(!inode->i_sb); |
107 | if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) | 142 | if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) |
108 | inode->i_sb->dq_op->initialize(inode, -1); | 143 | inode->i_sb->dq_op->initialize(inode, -1); |
109 | } | 144 | } |
110 | 145 | ||
@@ -112,7 +147,7 @@ static inline void vfs_dq_init(struct inode *inode) | |||
112 | * a transaction (deadlocks possible otherwise) */ | 147 | * a transaction (deadlocks possible otherwise) */ |
113 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) | 148 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) |
114 | { | 149 | { |
115 | if (sb_any_quota_enabled(inode->i_sb)) { | 150 | if (sb_any_quota_active(inode->i_sb)) { |
116 | /* Used space is updated in alloc_space() */ | 151 | /* Used space is updated in alloc_space() */ |
117 | if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA) | 152 | if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA) |
118 | return 1; | 153 | return 1; |
@@ -132,7 +167,7 @@ static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) | |||
132 | 167 | ||
133 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) | 168 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) |
134 | { | 169 | { |
135 | if (sb_any_quota_enabled(inode->i_sb)) { | 170 | if (sb_any_quota_active(inode->i_sb)) { |
136 | /* Used space is updated in alloc_space() */ | 171 | /* Used space is updated in alloc_space() */ |
137 | if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA) | 172 | if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA) |
138 | return 1; | 173 | return 1; |
@@ -152,7 +187,7 @@ static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) | |||
152 | 187 | ||
153 | static inline int vfs_dq_alloc_inode(struct inode *inode) | 188 | static inline int vfs_dq_alloc_inode(struct inode *inode) |
154 | { | 189 | { |
155 | if (sb_any_quota_enabled(inode->i_sb)) { | 190 | if (sb_any_quota_active(inode->i_sb)) { |
156 | vfs_dq_init(inode); | 191 | vfs_dq_init(inode); |
157 | if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) | 192 | if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) |
158 | return 1; | 193 | return 1; |
@@ -162,7 +197,7 @@ static inline int vfs_dq_alloc_inode(struct inode *inode) | |||
162 | 197 | ||
163 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) | 198 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) |
164 | { | 199 | { |
165 | if (sb_any_quota_enabled(inode->i_sb)) | 200 | if (sb_any_quota_active(inode->i_sb)) |
166 | inode->i_sb->dq_op->free_space(inode, nr); | 201 | inode->i_sb->dq_op->free_space(inode, nr); |
167 | else | 202 | else |
168 | inode_sub_bytes(inode, nr); | 203 | inode_sub_bytes(inode, nr); |
@@ -176,7 +211,7 @@ static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) | |||
176 | 211 | ||
177 | static inline void vfs_dq_free_inode(struct inode *inode) | 212 | static inline void vfs_dq_free_inode(struct inode *inode) |
178 | { | 213 | { |
179 | if (sb_any_quota_enabled(inode->i_sb)) | 214 | if (sb_any_quota_active(inode->i_sb)) |
180 | inode->i_sb->dq_op->free_inode(inode, 1); | 215 | inode->i_sb->dq_op->free_inode(inode, 1); |
181 | } | 216 | } |
182 | 217 | ||
@@ -197,12 +232,12 @@ static inline int vfs_dq_off(struct super_block *sb, int remount) | |||
197 | 232 | ||
198 | #else | 233 | #else |
199 | 234 | ||
200 | static inline int sb_has_quota_enabled(struct super_block *sb, int type) | 235 | static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type) |
201 | { | 236 | { |
202 | return 0; | 237 | return 0; |
203 | } | 238 | } |
204 | 239 | ||
205 | static inline int sb_any_quota_enabled(struct super_block *sb) | 240 | static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type) |
206 | { | 241 | { |
207 | return 0; | 242 | return 0; |
208 | } | 243 | } |
@@ -217,6 +252,27 @@ static inline int sb_any_quota_suspended(struct super_block *sb) | |||
217 | return 0; | 252 | return 0; |
218 | } | 253 | } |
219 | 254 | ||
255 | /* Does kernel know about any quota information for given sb + type? */ | ||
256 | static inline int sb_has_quota_loaded(struct super_block *sb, int type) | ||
257 | { | ||
258 | return 0; | ||
259 | } | ||
260 | |||
261 | static inline int sb_any_quota_loaded(struct super_block *sb) | ||
262 | { | ||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | static inline int sb_has_quota_active(struct super_block *sb, int type) | ||
267 | { | ||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | static inline int sb_any_quota_active(struct super_block *sb) | ||
272 | { | ||
273 | return 0; | ||
274 | } | ||
275 | |||
220 | /* | 276 | /* |
221 | * NO-OP when quota not configured. | 277 | * NO-OP when quota not configured. |
222 | */ | 278 | */ |