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.
27 * Author: Johann Lombardi <johann.lombardi@intel.com>
28 * Author: Niu Yawei <yawei.niu@intel.com>
32 # define EXPORT_SYMTAB
35 #define DEBUG_SUBSYSTEM S_LQUOTA
37 #include <obd_class.h>
38 #include "qmt_internal.h"
41 * Handle quotactl request.
43 * \param env - is the environment passed by the caller
44 * \param ld - is the lu device associated with the qmt
45 * \param oqctl - is the quotactl request
47 static int qmt_quotactl(const struct lu_env *env, struct lu_device *ld,
48 struct obd_quotactl *oqctl)
50 struct qmt_device *qmt = lu2qmt_dev(ld);
56 if (oqctl->qc_type >= MAXQUOTAS)
57 /* invalid quota type */
60 switch (oqctl->qc_cmd) {
65 /* XXX: not implemented yet. */
66 CERROR("quotactl operation %d not implemented yet\n",
71 /* XXX: return no limit for now, just for testing purpose */
72 memset(&oqctl->qc_dqblk, 0, sizeof(struct obd_dqblk));
73 oqctl->qc_dqblk.dqb_valid = QIF_LIMITS;
78 CERROR("%s: unsupported quotactl command: %d\n",
79 qmt->qmt_svname, oqctl->qc_cmd);
87 * Handle quota request from slave.
89 * \param env - is the environment passed by the caller
90 * \param ld - is the lu device associated with the qmt
91 * \param req - is the quota acquire request
93 static int qmt_dqacq(const struct lu_env *env, struct lu_device *ld,
94 struct ptlrpc_request *req)
96 struct quota_body *qbody, *repbody;
99 qbody = req_capsule_client_get(&req->rq_pill, &RMF_QUOTA_BODY);
101 RETURN(err_serious(-EPROTO));
103 repbody = req_capsule_server_get(&req->rq_pill, &RMF_QUOTA_BODY);
105 RETURN(err_serious(-EFAULT));
110 /* Vector of quota request handlers. This vector is used by the MDT to forward
111 * requests to the quota master. */
112 struct qmt_handlers qmt_hdls = {
113 /* quota request handlers */
114 .qmth_quotactl = qmt_quotactl,
115 .qmth_dqacq = qmt_dqacq,
118 .qmth_intent_policy = qmt_intent_policy,
119 .qmth_lvbo_init = qmt_lvbo_init,
120 .qmth_lvbo_update = qmt_lvbo_update,
121 .qmth_lvbo_size = qmt_lvbo_size,
122 .qmth_lvbo_fill = qmt_lvbo_fill,
123 .qmth_lvbo_free = qmt_lvbo_free,
125 EXPORT_SYMBOL(qmt_hdls);