1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/lvfs/lustre_quota_fmt.h
38 * Lustre administrative quota format
39 * from include/linux/quotaio_v2.h
41 #ifndef _LUSTRE_QUOTA_FMT_H
42 #define _LUSTRE_QUOTA_FMT_H
44 #include <linux/types.h>
45 #include <linux/quota.h>
48 * Definitions of magics and versions of current quota files
49 * Same with quota v2's magic
51 #define LUSTRE_INITQMAGICS {\
52 0xd9c01f11, /* USRQUOTA */\
53 0xd9c01927 /* GRPQUOTA */\
56 #define LUSTRE_INITQVERSIONS {\
62 * The following structure defines the format of the disk quota file
63 * (as it appears on disk) - the file is a radix tree whose leaves point
64 * to blocks of these structures.
66 struct lustre_disk_dqblk {
67 __u32 dqb_id; /* id this quota applies to */
68 __u32 dqb_ihardlimit; /* absolute limit on allocated inodes */
69 __u32 dqb_isoftlimit; /* preferred inode limit */
70 __u32 dqb_curinodes; /* current # allocated inodes */
71 __u32 dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */
72 __u32 dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */
73 __u64 dqb_curspace; /* current space occupied (in bytes) */
74 __u64 dqb_btime; /* time limit for excessive disk use */
75 __u64 dqb_itime; /* time limit for excessive inode use */
79 * Here are header structures as written on disk and their in-memory copies
81 /* First generic header */
82 struct lustre_disk_dqheader {
83 __u32 dqh_magic; /* Magic number identifying file */
84 __u32 dqh_version; /* File version */
87 /* Header with type and version specific information */
88 struct lustre_disk_dqinfo {
89 __u32 dqi_bgrace; /* Time before block soft limit becomes hard limit */
90 __u32 dqi_igrace; /* Time before inode soft limit becomes hard limit */
91 __u32 dqi_flags; /* Flags for quotafile (DQF_*) */
92 __u32 dqi_blocks; /* Number of blocks in file */
93 __u32 dqi_free_blk; /* Number of first free block in the list */
94 __u32 dqi_free_entry; /* Number of block with at least one free entry */
98 * Structure of header of block with quota structures. It is padded to 16 bytes so
99 * there will be space for exactly 21 quota-entries in a block
101 struct lustre_disk_dqdbheader {
102 __u32 dqdh_next_free; /* Number of next block with free entry */
103 __u32 dqdh_prev_free; /* Number of previous block with free entry */
104 __u16 dqdh_entries; /* Number of valid entries in block */
110 void lprocfs_quotfmt_test_init_vars(struct lprocfs_static_vars *lvars);
112 static void lprocfs_quotfmt_test_init_vars(struct lprocfs_static_vars *lvars) {}
115 #define LUSTRE_DQINFOOFF sizeof(struct lustre_disk_dqheader) /* Offset of info header in file */
116 #define LUSTRE_DQBLKSIZE_BITS 10
117 #define LUSTRE_DQBLKSIZE (1 << LUSTRE_DQBLKSIZE_BITS) /* Size of block with quota structures */
118 #define LUSTRE_DQTREEOFF 1 /* Offset of tree in file in blocks */
119 #define LUSTRE_DQTREEDEPTH 4 /* Depth of quota tree */
120 #define LUSTRE_DQSTRINBLK ((LUSTRE_DQBLKSIZE - sizeof(struct lustre_disk_dqdbheader)) / sizeof(struct lustre_disk_dqblk)) /* Number of entries in one blocks */
122 #endif /* lustre_quota_fmt.h */