aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/quota.h
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2010-10-27 18:15:57 -0400
committerMichal Marek <mmarek@suse.cz>2010-10-27 18:15:57 -0400
commitb74b953b998bcc2db91b694446f3a2619ec32de6 (patch)
tree6ce24caabd730f6ae9287ed0676ec32e6ff31e9d /include/linux/quota.h
parentabb438526201c6a79949ad45375c051b6681c253 (diff)
parentf6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff)
Merge commit 'v2.6.36' into kbuild/misc
Update to be able to fix a recent change to scripts/basic/docproc.c (commit eda603f).
Diffstat (limited to 'include/linux/quota.h')
-rw-r--r--include/linux/quota.h77
1 files changed, 38 insertions, 39 deletions
diff --git a/include/linux/quota.h b/include/linux/quota.h
index a6861f117480..94c1f03b50eb 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -174,6 +174,7 @@ enum {
174#include <linux/rwsem.h> 174#include <linux/rwsem.h>
175#include <linux/spinlock.h> 175#include <linux/spinlock.h>
176#include <linux/wait.h> 176#include <linux/wait.h>
177#include <linux/percpu_counter.h>
177 178
178#include <linux/dqblk_xfs.h> 179#include <linux/dqblk_xfs.h>
179#include <linux/dqblk_v1.h> 180#include <linux/dqblk_v1.h>
@@ -238,19 +239,36 @@ static inline int info_dirty(struct mem_dqinfo *info)
238 return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags); 239 return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags);
239} 240}
240 241
242enum {
243 DQST_LOOKUPS,
244 DQST_DROPS,
245 DQST_READS,
246 DQST_WRITES,
247 DQST_CACHE_HITS,
248 DQST_ALLOC_DQUOTS,
249 DQST_FREE_DQUOTS,
250 DQST_SYNCS,
251 _DQST_DQSTAT_LAST
252};
253
241struct dqstats { 254struct dqstats {
242 int lookups; 255 int stat[_DQST_DQSTAT_LAST];
243 int drops; 256 struct percpu_counter counter[_DQST_DQSTAT_LAST];
244 int reads;
245 int writes;
246 int cache_hits;
247 int allocated_dquots;
248 int free_dquots;
249 int syncs;
250}; 257};
251 258
259extern struct dqstats *dqstats_pcpu;
252extern struct dqstats dqstats; 260extern struct dqstats dqstats;
253 261
262static inline void dqstats_inc(unsigned int type)
263{
264 percpu_counter_inc(&dqstats.counter[type]);
265}
266
267static inline void dqstats_dec(unsigned int type)
268{
269 percpu_counter_dec(&dqstats.counter[type]);
270}
271
254#define DQ_MOD_B 0 /* dquot modified since read */ 272#define DQ_MOD_B 0 /* dquot modified since read */
255#define DQ_BLKS_B 1 /* uid/gid has been warned about blk limit */ 273#define DQ_BLKS_B 1 /* uid/gid has been warned about blk limit */
256#define DQ_INODES_B 2 /* uid/gid has been warned about inode limit */ 274#define DQ_INODES_B 2 /* uid/gid has been warned about inode limit */
@@ -279,9 +297,6 @@ struct dquot {
279 struct mem_dqblk dq_dqb; /* Diskquota usage */ 297 struct mem_dqblk dq_dqb; /* Diskquota usage */
280}; 298};
281 299
282#define QUOTA_OK 0
283#define NO_QUOTA 1
284
285/* Operations which must be implemented by each quota format */ 300/* Operations which must be implemented by each quota format */
286struct quota_format_ops { 301struct quota_format_ops {
287 int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */ 302 int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */
@@ -295,13 +310,6 @@ struct quota_format_ops {
295 310
296/* Operations working with dquots */ 311/* Operations working with dquots */
297struct dquot_operations { 312struct dquot_operations {
298 int (*initialize) (struct inode *, int);
299 int (*drop) (struct inode *);
300 int (*alloc_space) (struct inode *, qsize_t, int);
301 int (*alloc_inode) (const struct inode *, qsize_t);
302 int (*free_space) (struct inode *, qsize_t);
303 int (*free_inode) (const struct inode *, qsize_t);
304 int (*transfer) (struct inode *, struct iattr *);
305 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ 313 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
306 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ 314 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */
307 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ 315 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */
@@ -309,12 +317,6 @@ struct dquot_operations {
309 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ 317 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */
310 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ 318 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */
311 int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ 319 int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */
312 /* reserve quota for delayed block allocation */
313 int (*reserve_space) (struct inode *, qsize_t, int);
314 /* claim reserved quota for delayed alloc */
315 int (*claim_space) (struct inode *, qsize_t);
316 /* release rsved quota for delayed alloc */
317 void (*release_rsv) (struct inode *, qsize_t);
318 /* get reserved quota for delayed alloc, value returned is managed by 320 /* get reserved quota for delayed alloc, value returned is managed by
319 * quota code only */ 321 * quota code only */
320 qsize_t *(*get_reserved_space) (struct inode *); 322 qsize_t *(*get_reserved_space) (struct inode *);
@@ -322,17 +324,15 @@ struct dquot_operations {
322 324
323/* Operations handling requests from userspace */ 325/* Operations handling requests from userspace */
324struct quotactl_ops { 326struct quotactl_ops {
325 int (*quota_on)(struct super_block *, int, int, char *, int); 327 int (*quota_on)(struct super_block *, int, int, char *);
326 int (*quota_off)(struct super_block *, int, int); 328 int (*quota_off)(struct super_block *, int);
327 int (*quota_sync)(struct super_block *, int); 329 int (*quota_sync)(struct super_block *, int, int);
328 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 330 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
329 int (*set_info)(struct super_block *, int, struct if_dqinfo *); 331 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
330 int (*get_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); 332 int (*get_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *);
331 int (*set_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); 333 int (*set_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *);
332 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 334 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
333 int (*set_xstate)(struct super_block *, unsigned int, int); 335 int (*set_xstate)(struct super_block *, unsigned int, int);
334 int (*get_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
335 int (*set_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
336}; 336};
337 337
338struct quota_format_type { 338struct quota_format_type {
@@ -357,26 +357,25 @@ enum {
357#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \ 357#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \
358 DQUOT_SUSPENDED) 358 DQUOT_SUSPENDED)
359/* Other quota flags */ 359/* Other quota flags */
360#define DQUOT_QUOTA_SYS_FILE (1 << 6) /* Quota file is a special 360#define DQUOT_STATE_LAST (_DQUOT_STATE_FLAGS * MAXQUOTAS)
361#define DQUOT_QUOTA_SYS_FILE (1 << DQUOT_STATE_LAST)
362 /* Quota file is a special
361 * system file and user cannot 363 * system file and user cannot
362 * touch it. Filesystem is 364 * touch it. Filesystem is
363 * responsible for setting 365 * responsible for setting
364 * S_NOQUOTA, S_NOATIME flags 366 * S_NOQUOTA, S_NOATIME flags
365 */ 367 */
366#define DQUOT_NEGATIVE_USAGE (1 << 7) /* Allow negative quota usage */ 368#define DQUOT_NEGATIVE_USAGE (1 << (DQUOT_STATE_LAST + 1))
369 /* Allow negative quota usage */
367 370
368static inline unsigned int dquot_state_flag(unsigned int flags, int type) 371static inline unsigned int dquot_state_flag(unsigned int flags, int type)
369{ 372{
370 if (type == USRQUOTA) 373 return flags << _DQUOT_STATE_FLAGS * type;
371 return flags;
372 return flags << _DQUOT_STATE_FLAGS;
373} 374}
374 375
375static inline unsigned int dquot_generic_flag(unsigned int flags, int type) 376static inline unsigned int dquot_generic_flag(unsigned int flags, int type)
376{ 377{
377 if (type == USRQUOTA) 378 return (flags >> _DQUOT_STATE_FLAGS * type) & DQUOT_STATE_FLAGS;
378 return flags;
379 return flags >> _DQUOT_STATE_FLAGS;
380} 379}
381 380
382#ifdef CONFIG_QUOTA_NETLINK_INTERFACE 381#ifdef CONFIG_QUOTA_NETLINK_INTERFACE