1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Lustre administrative quota format
7 * include/linux/quotaio_v2.h
9 #ifndef _LUSTRE_QUOTA_FMT_H
10 #define _LUSTRE_QUOTA_FMT_H
12 #include <linux/types.h>
13 #include <linux/quota.h>
16 * Definitions of magics and versions of current quota files
17 * Same with quota v2's magic
19 #define LUSTRE_INITQMAGICS {\
20 0xd9c01f11, /* USRQUOTA */\
21 0xd9c01927 /* GRPQUOTA */\
24 #define LUSTRE_INITQVERSIONS {\
30 * The following structure defines the format of the disk quota file
31 * (as it appears on disk) - the file is a radix tree whose leaves point
32 * to blocks of these structures.
34 struct lustre_disk_dqblk {
35 __u32 dqb_id; /* id this quota applies to */
36 __u32 dqb_ihardlimit; /* absolute limit on allocated inodes */
37 __u32 dqb_isoftlimit; /* preferred inode limit */
38 __u32 dqb_curinodes; /* current # allocated inodes */
39 __u32 dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */
40 __u32 dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */
41 __u64 dqb_curspace; /* current space occupied (in bytes) */
42 __u64 dqb_btime; /* time limit for excessive disk use */
43 __u64 dqb_itime; /* time limit for excessive inode use */
47 * Here are header structures as written on disk and their in-memory copies
49 /* First generic header */
50 struct lustre_disk_dqheader {
51 __u32 dqh_magic; /* Magic number identifying file */
52 __u32 dqh_version; /* File version */
55 /* Header with type and version specific information */
56 struct lustre_disk_dqinfo {
57 __u32 dqi_bgrace; /* Time before block soft limit becomes hard limit */
58 __u32 dqi_igrace; /* Time before inode soft limit becomes hard limit */
59 __u32 dqi_flags; /* Flags for quotafile (DQF_*) */
60 __u32 dqi_blocks; /* Number of blocks in file */
61 __u32 dqi_free_blk; /* Number of first free block in the list */
62 __u32 dqi_free_entry; /* Number of block with at least one free entry */
66 * Structure of header of block with quota structures. It is padded to 16 bytes so
67 * there will be space for exactly 21 quota-entries in a block
69 struct lustre_disk_dqdbheader {
70 __u32 dqdh_next_free; /* Number of next block with free entry */
71 __u32 dqdh_prev_free; /* Number of previous block with free entry */
72 __u16 dqdh_entries; /* Number of valid entries in block */
78 void lprocfs_quotfmt_test_init_vars(struct lprocfs_static_vars *lvars);
80 static void lprocfs_quotfmt_test_init_vars(struct lprocfs_static_vars *lvars) {}
83 #define LUSTRE_DQINFOOFF sizeof(struct lustre_disk_dqheader) /* Offset of info header in file */
84 #define LUSTRE_DQBLKSIZE_BITS 10
85 #define LUSTRE_DQBLKSIZE (1 << LUSTRE_DQBLKSIZE_BITS) /* Size of block with quota structures */
86 #define LUSTRE_DQTREEOFF 1 /* Offset of tree in file in blocks */
87 #define LUSTRE_DQTREEDEPTH 4 /* Depth of quota tree */
88 #define LUSTRE_DQSTRINBLK ((LUSTRE_DQBLKSIZE - sizeof(struct lustre_disk_dqdbheader)) / sizeof(struct lustre_disk_dqblk)) /* Number of entries in one blocks */
90 #endif /* lustre_quota_fmt.h */