Whamcloud - gitweb
Added forgottent files needed for quota stuff
[fs/lustre-release.git] / lustre / ldiskfs / lustre_quota_fmt.h
1 /*
2  * Lustre administrative quota format
3  *
4  * from
5  * include/linux/quotaio_v2.h
6  */
7 #ifndef _LUSTRE_QUOTA_FMT_H
8 #define _LUSTRE_QUOTA_FMT_H
9
10 #include <linux/types.h>
11 #include <linux/quota.h>
12
13 /*
14  * Definitions of magics and versions of current quota files
15  * Same with quota v2's magic
16  */
17 #define LUSTRE_INITQMAGICS {\
18         0xd9c01f11,     /* USRQUOTA */\
19         0xd9c01927      /* GRPQUOTA */\
20 }
21
22 #define LUSTRE_INITQVERSIONS {\
23         0,              /* USRQUOTA */\
24         0               /* GRPQUOTA */\
25 }
26
27 /*
28  * The following structure defines the format of the disk quota file
29  * (as it appears on disk) - the file is a radix tree whose leaves point
30  * to blocks of these structures.
31  */
32 struct lustre_disk_dqblk {
33         __u32 dqb_id;           /* id this quota applies to */
34         __u32 dqb_ihardlimit;   /* absolute limit on allocated inodes */
35         __u32 dqb_isoftlimit;   /* preferred inode limit */
36         __u32 dqb_curinodes;    /* current # allocated inodes */
37         __u32 dqb_bhardlimit;   /* absolute limit on disk space (in QUOTABLOCK_SIZE) */
38         __u32 dqb_bsoftlimit;   /* preferred limit on disk space (in QUOTABLOCK_SIZE) */
39         __u64 dqb_curspace;     /* current space occupied (in bytes) */
40         __u64 dqb_btime;        /* time limit for excessive disk use */
41         __u64 dqb_itime;        /* time limit for excessive inode use */
42 };
43
44 /*
45  * Here are header structures as written on disk and their in-memory copies
46  */
47 /* First generic header */
48 struct lustre_disk_dqheader {
49         __u32 dqh_magic;        /* Magic number identifying file */
50         __u32 dqh_version;      /* File version */
51 };
52
53 /* Header with type and version specific information */
54 struct lustre_disk_dqinfo {
55         __u32 dqi_bgrace;       /* Time before block soft limit becomes hard limit */
56         __u32 dqi_igrace;       /* Time before inode soft limit becomes hard limit */
57         __u32 dqi_flags;        /* Flags for quotafile (DQF_*) */
58         __u32 dqi_blocks;       /* Number of blocks in file */
59         __u32 dqi_free_blk;     /* Number of first free block in the list */
60         __u32 dqi_free_entry;   /* Number of block with at least one free entry */
61 };
62
63 /*
64  *  Structure of header of block with quota structures. It is padded to 16 bytes so
65  *  there will be space for exactly 21 quota-entries in a block
66  */
67 struct lustre_disk_dqdbheader {
68         __u32 dqdh_next_free;   /* Number of next block with free entry */
69         __u32 dqdh_prev_free;   /* Number of previous block with free entry */
70         __u16 dqdh_entries;     /* Number of valid entries in block */
71         __u16 dqdh_pad1;
72         __u32 dqdh_pad2;
73 };
74
75 #define LUSTRE_DQINFOOFF        sizeof(struct lustre_disk_dqheader)     /* Offset of info header in file */
76 #define LUSTRE_DQBLKSIZE_BITS   10
77 #define LUSTRE_DQBLKSIZE        (1 << LUSTRE_DQBLKSIZE_BITS)    /* Size of block with quota structures */
78 #define LUSTRE_DQTREEOFF        1               /* Offset of tree in file in blocks */
79 #define LUSTRE_DQTREEDEPTH      4               /* Depth of quota tree */
80 #define LUSTRE_DQSTRINBLK       ((LUSTRE_DQBLKSIZE - sizeof(struct lustre_disk_dqdbheader)) / sizeof(struct lustre_disk_dqblk)) /* Number of entries in one blocks */
81
82
83 #endif /* lustre_quota_fmt.h */