4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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
24 * Copyright (c) 2012 Intel, Inc.
25 * Use is subject to license terms.
28 #include "lquota_internal.h"
30 #ifndef _QMT_INTERNAL_H
31 #define _QMT_INTERNAL_H
34 * The Quota Master Target Device.
35 * The qmt is responsible for:
36 * - all interactions with MDT0 (provide request handlers, share ldlm namespace,
37 * manage ldlm lvbo, ...)
38 * - all quota lock management (i.e. global quota locks as well as per-ID locks)
39 * - manage the quota pool configuration
41 * That's the structure MDT0 connects to in mdt_quota_init().
44 /* Super-class. dt_device/lu_device for this master target */
45 struct dt_device qmt_dt_dev;
47 /* service name of this qmt */
48 char qmt_svname[MAX_OBD_NAME];
50 /* Reference to the next device in the side stack
51 * The child device is actually the OSD device where we store the quota
53 struct obd_export *qmt_child_exp;
54 struct dt_device *qmt_child;
57 /* Common data shared by qmt handlers */
58 struct qmt_thread_info {
59 union lquota_rec qti_rec;
60 union lquota_id qti_id;
63 extern struct lu_context_key qmt_thread_key;
65 /* helper function to extract qmt_thread_info from current environment */
67 struct qmt_thread_info *qmt_info(const struct lu_env *env)
69 struct qmt_thread_info *info;
71 info = lu_context_key_get(&env->le_ctx, &qmt_thread_key);
73 lu_env_refill((struct lu_env *)env);
74 info = lu_context_key_get(&env->le_ctx, &qmt_thread_key);
80 /* helper routine to convert a lu_device into a qmt_device */
81 static inline struct qmt_device *lu2qmt_dev(struct lu_device *ld)
83 return container_of0(lu2dt_dev(ld), struct qmt_device, qmt_dt_dev);
86 /* helper routine to convert a qmt_device into lu_device */
87 static inline struct lu_device *qmt2lu_dev(struct qmt_device *qmt)
89 return &qmt->qmt_dt_dev.dd_lu_dev;
93 int qmt_intent_policy(const struct lu_env *, struct lu_device *,
94 struct ptlrpc_request *, struct ldlm_lock **, int);
95 int qmt_lvbo_init(struct lu_device *, struct ldlm_resource *);
96 int qmt_lvbo_update(struct lu_device *, struct ldlm_resource *,
97 struct ptlrpc_request *, int);
98 int qmt_lvbo_size(struct lu_device *, struct ldlm_lock *);
99 int qmt_lvbo_fill(struct lu_device *, struct ldlm_lock *, void *, int);
100 int qmt_lvbo_free(struct lu_device *, struct ldlm_resource *);
101 #endif /* _QMT_INTERNAL_H */