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, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2012, Whamcloud, Inc.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
37 #define DEBUG_SUBSYSTEM S_LQUOTA
40 # include <linux/version.h>
41 # include <linux/module.h>
42 # include <linux/init.h>
43 # include <linux/fs.h>
44 # include <linux/jbd.h>
45 # include <linux/smp_lock.h>
46 # include <linux/buffer_head.h>
47 # include <linux/workqueue.h>
48 # include <linux/mount.h>
49 #else /* __KERNEL__ */
50 # include <liblustre.h>
53 #include <obd_class.h>
54 #include <lustre_mds.h>
55 #include <lustre_dlm.h>
56 #include <lustre_cfg.h>
58 #include <lustre_fsfilt.h>
59 #include <lustre_quota.h>
60 #include <lprocfs_status.h>
61 #include "quota_internal.h"
65 static cfs_time_t last_print = 0;
66 static cfs_spinlock_t last_print_lock = CFS_SPIN_LOCK_UNLOCKED;
68 static int filter_quota_setup(struct obd_device *obd)
71 struct obd_device_target *obt = &obd->u.obt;
74 cfs_init_rwsem(&obt->obt_rwsem);
75 obt->obt_qfmt = LUSTRE_QUOTA_V2;
76 cfs_sema_init(&obt->obt_quotachecking, 1);
77 rc = qctxt_init(obd, NULL);
79 CERROR("initialize quota context failed! (rc:%d)\n", rc);
84 static int filter_quota_cleanup(struct obd_device *obd)
87 qctxt_cleanup(&obd->u.obt.obt_qctxt, 0);
91 static int filter_quota_setinfo(struct obd_device *obd, void *data)
93 struct obd_export *exp = data;
94 struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt;
95 struct obd_import *imp = exp->exp_imp_reverse;
100 /* setup the quota context import */
101 cfs_spin_lock(&qctxt->lqc_lock);
102 if (qctxt->lqc_import != NULL) {
103 cfs_spin_unlock(&qctxt->lqc_lock);
104 if (qctxt->lqc_import == imp)
105 CDEBUG(D_WARNING, "%s: lqc_import(%p) of obd(%p) was "
106 "activated already.\n", obd->obd_name, imp, obd);
108 CERROR("%s: lqc_import(%p:%p) of obd(%p) was "
109 "activated by others.\n", obd->obd_name,
110 qctxt->lqc_import, imp, obd);
112 qctxt->lqc_import = imp;
113 /* make imp's connect flags equal relative exp's connect flags
114 * adding it to avoid the scan export list */
115 imp->imp_connect_data.ocd_connect_flags |=
116 (exp->exp_connect_flags &
117 (OBD_CONNECT_QUOTA64 | OBD_CONNECT_CHANGE_QS));
118 cfs_spin_unlock(&qctxt->lqc_lock);
119 CDEBUG(D_QUOTA, "%s: lqc_import(%p) of obd(%p) is reactivated "
120 "now.\n", obd->obd_name, imp, obd);
122 cfs_waitq_signal(&qctxt->lqc_wait_for_qmaster);
123 /* start quota slave recovery thread. (release high limits) */
124 qslave_start_recovery(obd, qctxt);
129 static int filter_quota_clearinfo(struct obd_export *exp, struct obd_device *obd)
131 struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt;
132 struct obd_import *imp = exp->exp_imp_reverse;
135 /* lquota may be not set up before destroying export, b=14896 */
136 if (!obd->obd_set_up)
139 if (unlikely(imp == NULL))
142 /* when exp->exp_imp_reverse is destroyed, the corresponding lqc_import
143 * should be invalid b=12374 */
144 cfs_spin_lock(&qctxt->lqc_lock);
145 if (qctxt->lqc_import == imp) {
146 qctxt->lqc_import = NULL;
147 cfs_spin_unlock(&qctxt->lqc_lock);
148 CDEBUG(D_QUOTA, "%s: lqc_import(%p) of obd(%p) is invalid now.\n",
149 obd->obd_name, imp, obd);
150 ptlrpc_cleanup_imp(imp);
151 dqacq_interrupt(qctxt);
153 cfs_spin_unlock(&qctxt->lqc_lock);
158 static int filter_quota_enforce(struct obd_device *obd, unsigned int ignore)
162 if (!ll_sb_any_quota_active(obd->u.obt.obt_sb))
166 CDEBUG(D_QUOTA, "blocks will be written with ignoring quota.\n");
167 cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
169 cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
175 #define GET_OA_ID(flag, oa) (flag == USRQUOTA ? oa->o_uid : oa->o_gid)
176 static int filter_quota_getflag(struct obd_device *obd, struct obdo *oa)
178 struct obd_device_target *obt = &obd->u.obt;
179 struct lustre_quota_ctxt *qctxt = &obt->obt_qctxt;
180 int err, cnt, rc = 0;
181 struct obd_quotactl *oqctl;
184 if (!ll_sb_any_quota_active(obt->obt_sb))
187 OBD_ALLOC_PTR(oqctl);
191 /* set over quota flags for a uid/gid */
192 oa->o_valid |= OBD_MD_FLUSRQUOTA | OBD_MD_FLGRPQUOTA;
193 oa->o_flags &= ~(OBD_FL_NO_USRQUOTA | OBD_FL_NO_GRPQUOTA);
195 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
196 struct lustre_qunit_size *lqs = NULL;
198 lqs = quota_search_lqs(LQS_KEY(cnt, GET_OA_ID(cnt, oa)),
202 CDEBUG(D_QUOTA, "search lqs for %s %d failed, "
204 cnt == USRQUOTA ? "user" : "group",
205 GET_OA_ID(cnt, oa), rc);
207 } else if (lqs == NULL) {
208 /* continue to check group quota if the file's owner
209 * doesn't have quota limit. LU-530 */
212 cfs_spin_lock(&lqs->lqs_lock);
213 if (lqs->lqs_bunit_sz <= qctxt->lqc_sync_blk) {
214 oa->o_flags |= (cnt == USRQUOTA) ?
215 OBD_FL_NO_USRQUOTA : OBD_FL_NO_GRPQUOTA;
216 cfs_spin_unlock(&lqs->lqs_lock);
217 CDEBUG(D_QUOTA, "set sync flag: bunit(%lu), "
218 "sync_blk(%d)\n", lqs->lqs_bunit_sz,
219 qctxt->lqc_sync_blk);
220 /* this is for quota_search_lqs */
224 cfs_spin_unlock(&lqs->lqs_lock);
225 /* this is for quota_search_lqs */
229 memset(oqctl, 0, sizeof(*oqctl));
231 oqctl->qc_cmd = Q_GETQUOTA;
232 oqctl->qc_type = cnt;
233 oqctl->qc_id = (cnt == USRQUOTA) ? oa->o_uid : oa->o_gid;
234 err = fsfilt_quotactl(obd, obt->obt_sb, oqctl);
238 oa->o_valid &= ~((cnt == USRQUOTA) ? OBD_MD_FLUSRQUOTA :
240 CDEBUG(D_QUOTA, "fsfilt getquota for %s %d failed, "
242 cnt == USRQUOTA ? "user" : "group",
243 cnt == USRQUOTA ? oa->o_uid : oa->o_gid, err);
247 if (oqctl->qc_dqblk.dqb_bhardlimit &&
248 (toqb(oqctl->qc_dqblk.dqb_curspace) >=
249 oqctl->qc_dqblk.dqb_bhardlimit)) {
250 oa->o_flags |= (cnt == USRQUOTA) ?
251 OBD_FL_NO_USRQUOTA : OBD_FL_NO_GRPQUOTA;
252 CDEBUG(D_QUOTA, "out of quota for %s %d\n",
253 cnt == USRQUOTA ? "user" : "group",
254 cnt == USRQUOTA ? oa->o_uid : oa->o_gid);
262 * check whether the left quota of certain uid and gid can satisfy a block_write
263 * or inode_create rpc. When need to acquire quota, return QUOTA_RET_ACQUOTA
265 static int quota_check_common(struct obd_device *obd, const unsigned int id[],
266 int pending[], int count, int cycle, int isblk,
267 struct inode *inode, int frags)
269 struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt;
271 struct qunit_data qdata[MAXQUOTAS];
273 int rc = 0, rc2[2] = { 0, 0 };
276 cfs_spin_lock(&qctxt->lqc_lock);
277 if (!qctxt->lqc_valid){
278 cfs_spin_unlock(&qctxt->lqc_lock);
281 cfs_spin_unlock(&qctxt->lqc_lock);
283 for (i = 0; i < MAXQUOTAS; i++) {
284 struct lustre_qunit_size *lqs = NULL;
286 qdata[i].qd_id = id[i];
287 qdata[i].qd_flags = i;
289 QDATA_SET_BLK(&qdata[i]);
290 qdata[i].qd_count = 0;
292 /* ignore root user */
293 if (qdata[i].qd_id == 0 && !QDATA_IS_GRP(&qdata[i]))
296 lqs = quota_search_lqs(LQS_KEY(i, id[i]), qctxt, 0);
297 if (lqs == NULL || IS_ERR(lqs))
301 CERROR("can not find lqs for check_common: "
302 "[id %u] [%c] [isblk %d] [count %d] [rc %ld]\n",
303 id[i], i % 2 ? 'g': 'u', isblk, count,
305 RETURN(PTR_ERR(lqs));
308 rc2[i] = compute_remquota(obd, qctxt, &qdata[i], isblk);
309 cfs_spin_lock(&lqs->lqs_lock);
312 pending[i] = count * CFS_PAGE_SIZE;
313 /* in order to complete this write, we need extra
314 * meta blocks. This function can get it through
315 * data needed to be written b=16542 */
318 rc = fsfilt_get_mblk(obd, qctxt->lqc_sb,
322 CERROR("%s: can't get extra "
328 LASSERTF(pending[i] >= 0, "pending is not valid"
329 ", count=%d, mb=%d\n", count, mb);
330 lqs->lqs_bwrite_pending += pending[i];
333 lqs->lqs_iwrite_pending += pending[i];
337 /* if xx_rec < 0, that means quota are releasing,
338 * and it may return before we use quota. So if
339 * we find this situation, we assuming it has
340 * returned b=18491 */
341 if (isblk && lqs->lqs_blk_rec < 0) {
342 if (qdata[i].qd_count < -lqs->lqs_blk_rec)
343 qdata[i].qd_count = 0;
345 qdata[i].qd_count += lqs->lqs_blk_rec;
347 if (!isblk && lqs->lqs_ino_rec < 0) {
348 if (qdata[i].qd_count < -lqs->lqs_ino_rec)
349 qdata[i].qd_count = 0;
351 qdata[i].qd_count += lqs->lqs_ino_rec;
354 CDEBUG(D_QUOTA, "[id %u] [%c] [isblk %d] [count %d]"
355 " [lqs pending: %lu] [qd_count: "LPU64"] [metablocks: %d]"
356 " [pending: %d]\n", id[i], i % 2 ? 'g': 'u', isblk, count,
357 isblk ? lqs->lqs_bwrite_pending : lqs->lqs_iwrite_pending,
358 qdata[i].qd_count, mb, pending[i]);
359 if (rc2[i] == QUOTA_RET_OK) {
360 if (isblk && qdata[i].qd_count < lqs->lqs_bwrite_pending)
361 rc2[i] = QUOTA_RET_ACQUOTA;
362 if (!isblk && qdata[i].qd_count <
363 lqs->lqs_iwrite_pending)
364 rc2[i] = QUOTA_RET_ACQUOTA;
367 cfs_spin_unlock(&lqs->lqs_lock);
369 if (lqs->lqs_blk_rec < 0 &&
371 lqs->lqs_bwrite_pending - lqs->lqs_blk_rec - mb)
372 OBD_FAIL_TIMEOUT(OBD_FAIL_QUOTA_DELAY_REL, 5);
374 /* When cycle is zero, lqs_*_pending will be changed. We will
375 * get reference of the lqs here and put reference of lqs in
376 * quota_pending_commit b=14784 */
380 /* this is for quota_search_lqs */
384 if (rc2[0] == QUOTA_RET_ACQUOTA || rc2[1] == QUOTA_RET_ACQUOTA)
385 RETURN(QUOTA_RET_ACQUOTA);
390 int quota_is_set(struct obd_device *obd, const unsigned int id[], int flag)
392 struct lustre_qunit_size *lqs;
395 if (!ll_sb_any_quota_active(obd->u.obt.obt_qctxt.lqc_sb))
398 for (i = 0; i < MAXQUOTAS; i++) {
399 lqs = quota_search_lqs(LQS_KEY(i, id[i]),
400 &obd->u.obt.obt_qctxt, 0);
401 if (lqs && !IS_ERR(lqs)) {
402 if (lqs->lqs_flags & flag)
411 static int quota_chk_acq_common(struct obd_device *obd, struct obd_export *exp,
412 const unsigned int id[], int pending[],
413 int count, quota_acquire acquire,
414 struct obd_trans_info *oti, int isblk,
415 struct inode *inode, int frags)
417 struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt;
418 struct timeval work_start;
419 struct timeval work_end;
421 struct l_wait_info lwi = { 0 };
422 int rc = 0, cycle = 0, count_err = 1;
425 if (!quota_is_set(obd, id, isblk ? QB_SET : QI_SET))
428 if (isblk && (exp->exp_failed || exp->exp_abort_active_req))
429 /* If the client has been evicted or if it
430 * timed out and tried to reconnect already,
431 * abort the request immediately */
434 CDEBUG(D_QUOTA, "check quota for %s\n", obd->obd_name);
435 pending[USRQUOTA] = pending[GRPQUOTA] = 0;
436 /* Unfortunately, if quota master is too busy to handle the
437 * pre-dqacq in time and quota hash on ost is used up, we
438 * have to wait for the completion of in flight dqacq/dqrel,
439 * in order to get enough quota for write b=12588 */
440 cfs_gettimeofday(&work_start);
441 while ((rc = quota_check_common(obd, id, pending, count, cycle, isblk,
445 cfs_spin_lock(&qctxt->lqc_lock);
446 if (!qctxt->lqc_import && oti) {
447 cfs_spin_unlock(&qctxt->lqc_lock);
448 LASSERT(oti->oti_thread);
449 /* The recovery thread doesn't have watchdog
450 * attached. LU-369 */
451 if (oti->oti_thread->t_watchdog)
452 lc_watchdog_disable(oti->oti_thread->\
454 CDEBUG(D_QUOTA, "sleep for quota master\n");
455 l_wait_event(qctxt->lqc_wait_for_qmaster, check_qm(qctxt),
457 CDEBUG(D_QUOTA, "wake up when quota master is back\n");
458 if (oti->oti_thread->t_watchdog)
459 lc_watchdog_touch(oti->oti_thread->t_watchdog,
460 CFS_GET_TIMEOUT(oti->oti_thread->t_svc));
462 cfs_spin_unlock(&qctxt->lqc_lock);
467 OBD_FAIL_TIMEOUT(OBD_FAIL_OST_HOLD_WRITE_RPC, 90);
468 /* after acquire(), we should run quota_check_common again
469 * so that we confirm there are enough quota to finish write */
470 rc = acquire(obd, id, oti, isblk);
472 /* please reference to dqacq_completion for the below */
473 /* a new request is finished, try again */
474 if (rc == QUOTA_REQ_RETURNED) {
475 CDEBUG(D_QUOTA, "finish a quota req, try again\n");
479 /* it is out of quota already */
481 CDEBUG(D_QUOTA, "out of quota, return -EDQUOT\n");
485 /* Related quota has been disabled by master, but enabled by
486 * slave, do not try again. */
487 if (unlikely(rc == -ESRCH)) {
488 CERROR("mismatched quota configuration, stop try.\n");
492 if (isblk && (exp->exp_failed || exp->exp_abort_active_req))
493 /* The client has been evicted or tried to
494 * to reconnect already, abort the request */
497 /* -EBUSY and others, wait a second and try again */
500 struct l_wait_info lwi;
502 if (oti && oti->oti_thread && oti->oti_thread->t_watchdog)
503 lc_watchdog_touch(oti->oti_thread->t_watchdog,
504 CFS_GET_TIMEOUT(oti->oti_thread->t_svc));
505 CDEBUG(D_QUOTA, "rc: %d, count_err: %d\n", rc,
508 cfs_waitq_init(&waitq);
509 lwi = LWI_TIMEOUT(cfs_time_seconds(min(cycle, 10)), NULL,
511 l_wait_event(waitq, 0, &lwi);
514 if (rc < 0 || cycle % 10 == 0) {
515 cfs_spin_lock(&last_print_lock);
516 if (last_print == 0 ||
517 cfs_time_before((last_print + cfs_time_seconds(30)),
518 cfs_time_current())) {
519 last_print = cfs_time_current();
520 cfs_spin_unlock(&last_print_lock);
521 CWARN("still haven't managed to acquire quota "
522 "space from the quota master after %d "
523 "retries (err=%d, rc=%d)\n",
524 cycle, count_err - 1, rc);
526 cfs_spin_unlock(&last_print_lock);
530 CDEBUG(D_QUOTA, "recheck quota with rc: %d, cycle: %d\n", rc,
533 cfs_gettimeofday(&work_end);
534 timediff = cfs_timeval_sub(&work_end, &work_start, NULL);
535 lprocfs_counter_add(qctxt->lqc_stats,
536 isblk ? LQUOTA_WAIT_FOR_CHK_BLK :
537 LQUOTA_WAIT_FOR_CHK_INO,
546 * when a block_write or inode_create rpc is finished, adjust the record for
547 * pending blocks and inodes
549 static int quota_pending_commit(struct obd_device *obd, const unsigned int id[],
550 int pending[], int isblk)
552 struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt;
553 struct timeval work_start;
554 struct timeval work_end;
557 struct qunit_data qdata[MAXQUOTAS];
560 CDEBUG(D_QUOTA, "commit pending quota for %s\n", obd->obd_name);
561 CLASSERT(MAXQUOTAS < 4);
562 if (!ll_sb_any_quota_active(qctxt->lqc_sb))
565 cfs_gettimeofday(&work_start);
566 for (i = 0; i < MAXQUOTAS; i++) {
567 struct lustre_qunit_size *lqs = NULL;
569 LASSERT(pending[i] >= 0);
573 qdata[i].qd_id = id[i];
574 qdata[i].qd_flags = i;
576 QDATA_SET_BLK(&qdata[i]);
577 qdata[i].qd_count = 0;
579 if (qdata[i].qd_id == 0 && !QDATA_IS_GRP(&qdata[i]))
582 lqs = quota_search_lqs(LQS_KEY(i, qdata[i].qd_id), qctxt, 0);
583 if (lqs == NULL || IS_ERR(lqs)) {
584 CERROR("can not find lqs for pending_commit: "
585 "[id %u] [%c] [pending %u] [isblk %d] (rc %ld), "
586 "maybe cause unexpected lqs refcount error!\n",
587 id[i], i ? 'g': 'u', pending[i], isblk,
588 lqs ? PTR_ERR(lqs) : -1);
592 cfs_spin_lock(&lqs->lqs_lock);
594 LASSERTF(lqs->lqs_bwrite_pending >= pending[i],
595 "there are too many blocks! [id %u] [%c] "
596 "[bwrite_pending %lu] [pending %u]\n",
597 id[i], i % 2 ? 'g' : 'u',
598 lqs->lqs_bwrite_pending, pending[i]);
600 lqs->lqs_bwrite_pending -= pending[i];
602 LASSERTF(lqs->lqs_iwrite_pending >= pending[i],
603 "there are too many files! [id %u] [%c] "
604 "[iwrite_pending %lu] [pending %u]\n",
605 id[i], i % 2 ? 'g' : 'u',
606 lqs->lqs_iwrite_pending, pending[i]);
608 lqs->lqs_iwrite_pending -= pending[i];
610 CDEBUG(D_QUOTA, "%s: lqs_pending=%lu pending[%d]=%d isblk=%d\n",
612 isblk ? lqs->lqs_bwrite_pending : lqs->lqs_iwrite_pending,
613 i, pending[i], isblk);
614 cfs_spin_unlock(&lqs->lqs_lock);
616 /* for quota_search_lqs in pending_commit */
618 /* for quota_search_lqs in quota_check */
621 cfs_gettimeofday(&work_end);
622 timediff = cfs_timeval_sub(&work_end, &work_start, NULL);
623 lprocfs_counter_add(qctxt->lqc_stats,
624 isblk ? LQUOTA_WAIT_FOR_COMMIT_BLK :
625 LQUOTA_WAIT_FOR_COMMIT_INO,
631 static int mds_quota_init(void)
633 return lustre_dquot_init();
636 static int mds_quota_exit(void)
642 static int mds_quota_setup(struct obd_device *obd)
644 struct obd_device_target *obt = &obd->u.obt;
645 struct mds_obd *mds = &obd->u.mds;
649 if (unlikely(mds->mds_quota)) {
650 CWARN("try to reinitialize quota context!\n");
654 cfs_init_rwsem(&obt->obt_rwsem);
655 obt->obt_qfmt = LUSTRE_QUOTA_V2;
656 mds->mds_quota_info.qi_version = LUSTRE_QUOTA_V2;
657 cfs_sema_init(&obt->obt_quotachecking, 1);
658 /* initialize quota master and quota context */
659 cfs_init_rwsem(&mds->mds_qonoff_sem);
660 rc = qctxt_init(obd, dqacq_handler);
662 CERROR("%s: initialize quota context failed! (rc:%d)\n",
670 static int mds_quota_cleanup(struct obd_device *obd)
673 if (unlikely(!obd->u.mds.mds_quota))
676 qctxt_cleanup(&obd->u.obt.obt_qctxt, 0);
680 static int mds_quota_setinfo(struct obd_device *obd, void *data)
682 struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt;
685 if (unlikely(!obd->u.mds.mds_quota))
689 QUOTA_MASTER_READY(qctxt);
691 QUOTA_MASTER_UNREADY(qctxt);
695 static int mds_quota_fs_cleanup(struct obd_device *obd)
697 struct mds_obd *mds = &obd->u.mds;
698 struct obd_quotactl oqctl;
701 if (unlikely(!mds->mds_quota))
705 memset(&oqctl, 0, sizeof(oqctl));
706 oqctl.qc_type = UGQUOTA;
708 cfs_down_write(&mds->mds_qonoff_sem);
709 mds_admin_quota_off(obd, &oqctl);
710 cfs_up_write(&mds->mds_qonoff_sem);
714 static int quota_acquire_common(struct obd_device *obd, const unsigned int id[],
715 struct obd_trans_info *oti, int isblk)
717 struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt;
721 rc = qctxt_adjust_qunit(obd, qctxt, id, isblk, 1, oti);
725 quota_interface_t mds_quota_interface = {
726 .quota_init = mds_quota_init,
727 .quota_exit = mds_quota_exit,
728 .quota_setup = mds_quota_setup,
729 .quota_cleanup = mds_quota_cleanup,
730 .quota_check = target_quota_check,
731 .quota_ctl = mds_quota_ctl,
732 .quota_setinfo = mds_quota_setinfo,
733 .quota_fs_cleanup = mds_quota_fs_cleanup,
734 .quota_recovery = mds_quota_recovery,
735 .quota_adjust = mds_quota_adjust,
736 .quota_chkquota = quota_chk_acq_common,
737 .quota_acquire = quota_acquire_common,
738 .quota_pending_commit = quota_pending_commit,
741 quota_interface_t filter_quota_interface = {
742 .quota_setup = filter_quota_setup,
743 .quota_cleanup = filter_quota_cleanup,
744 .quota_check = target_quota_check,
745 .quota_ctl = filter_quota_ctl,
746 .quota_setinfo = filter_quota_setinfo,
747 .quota_clearinfo = filter_quota_clearinfo,
748 .quota_enforce = filter_quota_enforce,
749 .quota_getflag = filter_quota_getflag,
750 .quota_acquire = quota_acquire_common,
751 .quota_adjust = filter_quota_adjust,
752 .quota_chkquota = quota_chk_acq_common,
753 .quota_adjust_qunit = filter_quota_adjust_qunit,
754 .quota_pending_commit = quota_pending_commit,
757 cfs_proc_dir_entry_t *lquota_type_proc_dir = NULL;
759 static int __init init_lustre_quota(void)
763 lquota_type_proc_dir = lprocfs_register(OBD_LQUOTA_DEVICENAME,
766 if (IS_ERR(lquota_type_proc_dir)) {
767 CERROR("LProcFS failed in lquota-init\n");
768 rc = PTR_ERR(lquota_type_proc_dir);
772 rc = qunit_cache_init();
776 PORTAL_SYMBOL_REGISTER(filter_quota_interface);
777 PORTAL_SYMBOL_REGISTER(mds_quota_interface);
782 static void /*__exit*/ exit_lustre_quota(void)
784 PORTAL_SYMBOL_UNREGISTER(filter_quota_interface);
785 PORTAL_SYMBOL_UNREGISTER(mds_quota_interface);
787 qunit_cache_cleanup();
789 if (lquota_type_proc_dir)
790 lprocfs_remove(&lquota_type_proc_dir);
793 MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
794 MODULE_DESCRIPTION("Lustre Quota");
795 MODULE_LICENSE("GPL");
797 cfs_module(lquota, "1.0.0", init_lustre_quota, exit_lustre_quota);
799 EXPORT_SYMBOL(mds_quota_interface);
800 EXPORT_SYMBOL(filter_quota_interface);
801 #endif /* __KERNEL */