Whamcloud - gitweb
LU-1818 quota: en/disable quota enforcement via conf_param
[fs/lustre-release.git] / lustre / quota / qsd_internal.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 021110-1307, USA
20  *
21  * GPL HEADER END
22  */
23 /*
24  * Copyright (c) 2012 Whamcloud, Inc.
25  * Use is subject to license terms.
26  */
27
28 #include "lquota_internal.h"
29
30 #ifndef _QSD_INTERNAL_H
31 #define _QSD_INTERNAL_H
32
33 struct qsd_type_info;
34
35 /*
36  * A QSD instance implements quota enforcement support for a given OSD.
37  * The instance can be created via qsd_init() and then freed with qsd_fini().
38  * This structure gathers all quota parameters and pointers to on-disk indexes
39  * required on quota slave to:
40  * i. acquire/release quota space from the QMT;
41  * ii. allocate this quota space to local requests.
42  */
43 struct qsd_instance {
44         /* name of service which created this qsd instance */
45         char                     qsd_svname[MAX_OBD_NAME];
46
47         /* dt_device associated with this qsd instance */
48         struct dt_device        *qsd_dev;
49
50         /* procfs directory where information related to the underlying slaves
51          * are exported */
52         cfs_proc_dir_entry_t    *qsd_proc;
53
54         /* We create 2 quota slave instances:
55          * - one for user quota
56          * - one for group quota
57          *
58          * This will have to be revisited if new quota types are added in the
59          * future. For the time being, we can just use an array. */
60         struct qsd_qtype_info   *qsd_type_array[MAXQUOTAS];
61 };
62
63 /*
64  * Per-type quota information.
65  * Quota slave instance for a specific quota type. The qsd instance has one such
66  * structure for each quota type (i.e. user & group).
67  */
68 struct qsd_qtype_info {
69         /* quota type, either USRQUOTA or GRPQUOTA
70          * immutable after creation. */
71         int                      qqi_qtype;
72
73         /* back pointer to qsd device
74          * immutable after creation. */
75         struct qsd_instance     *qqi_qsd;
76
77         /* Local index files storing quota settings for this quota type */
78         struct dt_object        *qqi_acct_obj; /* accounting object */
79 };
80 #endif /* _QSD_INTERNAL_H */