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.
37 #define DEBUG_SUBSYSTEM S_LQUOTA
39 #include <linux/version.h>
40 #include <lprocfs_status.h>
42 #include <linux/seq_file.h>
43 #include <lustre_fsfilt.h>
45 #include "quota_internal.h"
47 #ifdef HAVE_QUOTA_SUPPORT
50 int lprocfs_quota_rd_bunit(char *page, char **start, off_t off, int count,
53 struct obd_device *obd = (struct obd_device *)data;
56 return snprintf(page, count, "%lu\n",
57 obd->u.obt.obt_qctxt.lqc_bunit_sz);
59 EXPORT_SYMBOL(lprocfs_quota_rd_bunit);
61 int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
62 unsigned long count, void *data)
64 struct obd_device *obd = (struct obd_device *)data;
68 rc = lprocfs_write_helper(buffer, count, &val);
72 if (val % QUOTABLOCK_SIZE ||
73 val <= obd->u.obt.obt_qctxt.lqc_btune_sz)
76 obd->u.obt.obt_qctxt.lqc_bunit_sz = val;
79 EXPORT_SYMBOL(lprocfs_quota_wr_bunit);
81 int lprocfs_quota_rd_btune(char *page, char **start, off_t off, int count,
84 struct obd_device *obd = (struct obd_device *)data;
87 return snprintf(page, count, "%lu\n",
88 obd->u.obt.obt_qctxt.lqc_btune_sz);
90 EXPORT_SYMBOL(lprocfs_quota_rd_btune);
92 int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
93 unsigned long count, void *data)
95 struct obd_device *obd = (struct obd_device *)data;
99 rc = lprocfs_write_helper(buffer, count, &val);
103 if (val <= QUOTABLOCK_SIZE * MIN_QLIMIT || val % QUOTABLOCK_SIZE ||
104 val >= obd->u.obt.obt_qctxt.lqc_bunit_sz)
107 obd->u.obt.obt_qctxt.lqc_btune_sz = val;
110 EXPORT_SYMBOL(lprocfs_quota_wr_btune);
112 int lprocfs_quota_rd_iunit(char *page, char **start, off_t off, int count,
113 int *eof, void *data)
115 struct obd_device *obd = (struct obd_device *)data;
116 LASSERT(obd != NULL);
118 return snprintf(page, count, "%lu\n",
119 obd->u.obt.obt_qctxt.lqc_iunit_sz);
121 EXPORT_SYMBOL(lprocfs_quota_rd_iunit);
123 int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
124 unsigned long count, void *data)
126 struct obd_device *obd = (struct obd_device *)data;
128 LASSERT(obd != NULL);
130 rc = lprocfs_write_helper(buffer, count, &val);
134 if (val <= obd->u.obt.obt_qctxt.lqc_itune_sz)
137 obd->u.obt.obt_qctxt.lqc_iunit_sz = val;
140 EXPORT_SYMBOL(lprocfs_quota_wr_iunit);
142 int lprocfs_quota_rd_itune(char *page, char **start, off_t off, int count,
143 int *eof, void *data)
145 struct obd_device *obd = (struct obd_device *)data;
146 LASSERT(obd != NULL);
148 return snprintf(page, count, "%lu\n",
149 obd->u.obt.obt_qctxt.lqc_itune_sz);
151 EXPORT_SYMBOL(lprocfs_quota_rd_itune);
153 int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
154 unsigned long count, void *data)
156 struct obd_device *obd = (struct obd_device *)data;
158 LASSERT(obd != NULL);
160 rc = lprocfs_write_helper(buffer, count, &val);
164 if (val <= MIN_QLIMIT ||
165 val >= obd->u.obt.obt_qctxt.lqc_iunit_sz)
168 obd->u.obt.obt_qctxt.lqc_itune_sz = val;
171 EXPORT_SYMBOL(lprocfs_quota_wr_itune);
174 #define GROUP_QUOTA 2
176 #define MAX_STYPE_SIZE 5
178 /* The following information about CURRENT quotas is expected on the output:
179 * MDS: u for user quotas (administrative+operational) turned on,
180 * g for group quotas (administrative+operational) turned on,
181 * 1 for 32-bit operational quotas and 32-bit administrative quotas,
182 * 2 for 32-bit operational quotas and 64-bit administrative quotas,
183 * 3 for 64-bit operational quotas and 64-bit administrative quotas
184 * OST: u for user quotas (operational) turned on,
185 * g for group quotas (operational) turned on,
186 * 1 for 32-bit local operational quotas,
187 * 3 for 64-bit local operational quotas,
188 * Permanent parameters can be read with lctl (?)
190 int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
191 int *eof, void *data)
193 struct obd_device *obd = (struct obd_device *)data;
194 char stype[MAX_STYPE_SIZE + 1] = "";
195 int oq_type, rc, is_mds;
196 lustre_quota_version_t aq_version, oq_version;
197 struct obd_device_target *obt;
199 LASSERT(obd != NULL);
202 is_mds = !strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME);
204 /* Collect the needed information */
205 oq_type = obd->u.obt.obt_qctxt.lqc_flags;
206 oq_version = obt->obt_qfmt;
208 rc = mds_quota_get_version(obd, &aq_version);
211 /* Here we can also assert that aq_type == oq_type
212 * except for quota startup/shutdown states */
215 /* Transform the collected data into a user-readable string */
216 if (oq_type & LQC_USRQUOTA_FLAG)
218 if (oq_type & LQC_GRPQUOTA_FLAG)
221 if ((!is_mds || aq_version == LUSTRE_QUOTA_V1) &&
222 oq_version == LUSTRE_QUOTA_V1)
225 else if ((!is_mds || aq_version == LUSTRE_QUOTA_V2) &&
226 oq_version == LUSTRE_QUOTA_V2)
229 else if (is_mds && aq_version == LUSTRE_QUOTA_V2 &&
230 oq_version == LUSTRE_QUOTA_V1)
235 return snprintf(page, count, "%s\n", stype);
237 EXPORT_SYMBOL(lprocfs_quota_rd_type);
239 static int auto_quota_on(struct obd_device *obd, int type,
240 struct super_block *sb, int is_master)
242 struct obd_quotactl *oqctl;
243 struct lvfs_run_ctxt saved;
245 struct obd_device_target *obt;
248 LASSERT(type == USRQUOTA || type == GRPQUOTA || type == UGQUOTA);
252 OBD_ALLOC_PTR(oqctl);
256 if (!atomic_dec_and_test(&obt->obt_quotachecking)) {
257 CDEBUG(D_INFO, "other people are doing quotacheck\n");
258 atomic_inc(&obt->obt_quotachecking);
262 id = UGQUOTA2LQC(type);
263 /* quota already turned on */
264 if ((obt->obt_qctxt.lqc_flags & id) == id) {
269 oqctl->qc_type = type;
270 oqctl->qc_cmd = Q_QUOTAON;
271 oqctl->qc_id = obt->obt_qfmt;
273 push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
275 struct mds_obd *mds = &obd->u.mds;
277 down(&mds->mds_qonoff_sem);
278 /* turn on cluster wide quota */
279 rc = mds_admin_quota_on(obd, oqctl);
281 CDEBUG(rc == -ENOENT ? D_QUOTA : D_ERROR,
282 "auto-enable admin quota failed. rc=%d\n", rc);
283 up(&mds->mds_qonoff_sem);
287 /* turn on local quota */
288 rc = fsfilt_quotactl(obd, sb, oqctl);
290 CDEBUG(rc == -ENOENT ? D_QUOTA : D_ERROR,
291 "auto-enable local quota failed. rc=%d\n", rc);
293 obt->obt_qctxt.lqc_flags |= UGQUOTA2LQC(type);
296 pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
299 atomic_inc(&obt->obt_quotachecking);
305 static int filter_quota_set_version(struct obd_device *obd,
306 lustre_quota_version_t version)
308 struct obd_device_target *obt = &obd->u.obt;
310 if (version != LUSTRE_QUOTA_V1) {
312 if (version != LUSTRE_QUOTA_V2)
317 if (!atomic_dec_and_test(&obt->obt_quotachecking)) {
318 CDEBUG(D_INFO, "other people are doing quotacheck\n");
319 atomic_inc(&obt->obt_quotachecking);
323 if (obt->obt_qctxt.lqc_flags & (LQC_USRQUOTA_FLAG | LQC_GRPQUOTA_FLAG)) {
324 atomic_inc(&obt->obt_quotachecking);
328 obt->obt_qfmt = version;
330 atomic_inc(&obt->obt_quotachecking);
335 /* The following settings of CURRENT quotas is expected on the input:
336 * MDS: u for user quotas (administrative+operational) turned on,
337 * g for group quotas (administrative+operational) turned on,
338 * 1 for 32-bit operational quotas and 32-bit administrative quotas,
339 * 2 for 32-bit operational quotas and 64-bit administrative quotas,
340 * 3 for 64-bit operational quotas and 64-bit administrative quotas
341 * OST: u for user quotas (operational) turned on,
342 * g for group quotas (operational) turned on,
343 * 1 for 32-bit local operational quotas,
344 * 2 for 32-bit local operational quotas,
345 * 3 for 64-bit local operational quotas,
346 * Permanent parameters can be set with lctl/tunefs
348 int lprocfs_quota_wr_type(struct file *file, const char *buffer,
349 unsigned long count, void *data)
351 struct obd_device *obd = (struct obd_device *)data;
352 struct obd_device_target *obt;
353 int type = 0, is_mds, idx;
355 char stype[MAX_STYPE_SIZE + 1] = "";
356 static const lustre_quota_version_t s2av[3] = {LUSTRE_QUOTA_V1,
359 s2ov[3] = {LUSTRE_QUOTA_V1,
362 LASSERT(obd != NULL);
366 is_mds = !strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME);
368 if (count > MAX_STYPE_SIZE)
371 if (copy_from_user(stype, buffer, count))
374 for (i = 0 ; i < count ; i++) {
384 /* quota version specifiers */
388 idx = stype[i] - '1';
390 if (s2ov[idx] == LUSTRE_QUOTA_V2)
394 rc = mds_quota_set_version(obd, s2av[idx]);
396 CDEBUG(D_QUOTA, "failed to set admin "
397 "quota to spec %c! %d\n",
402 rc = filter_quota_set_version(obd, s2ov[idx]);
404 CDEBUG(D_QUOTA, "failed to set operational quota"
405 " to spec %c! %d\n", stype[i], rc);
409 default : /* just skip stray symbols like \n */
415 auto_quota_on(obd, type - 1, obt->obt_sb, is_mds);
419 EXPORT_SYMBOL(lprocfs_quota_wr_type);
421 int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
422 int count, int *eof, void *data)
424 struct obd_device *obd = (struct obd_device *)data;
425 LASSERT(obd != NULL);
427 return snprintf(page, count, "%d\n",
428 obd->u.obt.obt_qctxt.lqc_switch_seconds);
430 EXPORT_SYMBOL(lprocfs_quota_rd_switch_seconds);
432 int lprocfs_quota_wr_switch_seconds(struct file *file, const char *buffer,
433 unsigned long count, void *data)
435 struct obd_device *obd = (struct obd_device *)data;
437 LASSERT(obd != NULL);
439 rc = lprocfs_write_helper(buffer, count, &val);
446 obd->u.obt.obt_qctxt.lqc_switch_seconds = val;
449 EXPORT_SYMBOL(lprocfs_quota_wr_switch_seconds);
451 int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
452 int count, int *eof, void *data)
454 struct obd_device *obd = (struct obd_device *)data;
455 LASSERT(obd != NULL);
457 return snprintf(page, count, "%d\n",
458 obd->u.obt.obt_qctxt.lqc_sync_blk);
460 EXPORT_SYMBOL(lprocfs_quota_rd_sync_blk);
462 int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
463 unsigned long count, void *data)
465 struct obd_device *obd = (struct obd_device *)data;
467 LASSERT(obd != NULL);
469 rc = lprocfs_write_helper(buffer, count, &val);
476 obd->u.obt.obt_qctxt.lqc_sync_blk = val;
479 EXPORT_SYMBOL(lprocfs_quota_wr_sync_blk);
481 int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
482 int count, int *eof, void *data)
484 struct obd_device *obd = (struct obd_device *)data;
485 LASSERT(obd != NULL);
487 return snprintf(page, count, "changing qunit size is %s\n",
488 obd->u.obt.obt_qctxt.lqc_switch_qs ?
489 "enabled" : "disabled");
491 EXPORT_SYMBOL(lprocfs_quota_rd_switch_qs);
493 int lprocfs_quota_wr_switch_qs(struct file *file, const char *buffer,
494 unsigned long count, void *data)
496 struct obd_device *obd = (struct obd_device *)data;
498 LASSERT(obd != NULL);
500 rc = lprocfs_write_helper(buffer, count, &val);
505 obd->u.obt.obt_qctxt.lqc_switch_qs = 1;
507 obd->u.obt.obt_qctxt.lqc_switch_qs = 0;
511 EXPORT_SYMBOL(lprocfs_quota_wr_switch_qs);
513 int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
514 int count, int *eof, void *data)
516 struct obd_device *obd = (struct obd_device *)data;
517 LASSERT(obd != NULL);
520 return snprintf(page, count, "%lu\n",
521 obd->u.obt.obt_qctxt.lqc_cqs_boundary_factor);
523 EXPORT_SYMBOL(lprocfs_quota_rd_boundary_factor);
525 int lprocfs_quota_wr_boundary_factor(struct file *file, const char *buffer,
526 unsigned long count, void *data)
528 struct obd_device *obd = (struct obd_device *)data;
530 LASSERT(obd != NULL);
532 rc = lprocfs_write_helper(buffer, count, &val);
539 obd->u.obt.obt_qctxt.lqc_cqs_boundary_factor = val;
542 EXPORT_SYMBOL(lprocfs_quota_wr_boundary_factor);
544 int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
545 int count, int *eof, void *data)
547 struct obd_device *obd = (struct obd_device *)data;
548 LASSERT(obd != NULL);
551 return snprintf(page, count, "%lu\n",
552 obd->u.obt.obt_qctxt.lqc_cqs_least_bunit);
554 EXPORT_SYMBOL(lprocfs_quota_rd_least_bunit);
556 int lprocfs_quota_wr_least_bunit(struct file *file, const char *buffer,
557 unsigned long count, void *data)
559 struct obd_device *obd = (struct obd_device *)data;
561 LASSERT(obd != NULL);
563 rc = lprocfs_write_helper(buffer, count, &val);
567 if (val < PTLRPC_MAX_BRW_SIZE ||
568 val >= obd->u.obt.obt_qctxt.lqc_bunit_sz)
571 obd->u.obt.obt_qctxt.lqc_cqs_least_bunit = val;
574 EXPORT_SYMBOL(lprocfs_quota_wr_least_bunit);
576 int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
577 int count, int *eof, void *data)
579 struct obd_device *obd = (struct obd_device *)data;
580 LASSERT(obd != NULL);
583 return snprintf(page, count, "%lu\n",
584 obd->u.obt.obt_qctxt.lqc_cqs_least_iunit);
586 EXPORT_SYMBOL(lprocfs_quota_rd_least_iunit);
588 int lprocfs_quota_wr_least_iunit(struct file *file, const char *buffer,
589 unsigned long count, void *data)
591 struct obd_device *obd = (struct obd_device *)data;
593 LASSERT(obd != NULL);
595 rc = lprocfs_write_helper(buffer, count, &val);
599 if (val < 1 || val >= obd->u.obt.obt_qctxt.lqc_iunit_sz)
602 obd->u.obt.obt_qctxt.lqc_cqs_least_iunit = val;
605 EXPORT_SYMBOL(lprocfs_quota_wr_least_iunit);
607 int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
608 int count, int *eof, void *data)
610 struct obd_device *obd = (struct obd_device *)data;
611 LASSERT(obd != NULL);
614 return snprintf(page, count, "%lu\n",
615 obd->u.obt.obt_qctxt.lqc_cqs_qs_factor);
617 EXPORT_SYMBOL(lprocfs_quota_rd_qs_factor);
619 int lprocfs_quota_wr_qs_factor(struct file *file, const char *buffer,
620 unsigned long count, void *data)
622 struct obd_device *obd = (struct obd_device *)data;
624 LASSERT(obd != NULL);
626 rc = lprocfs_write_helper(buffer, count, &val);
633 obd->u.obt.obt_qctxt.lqc_cqs_qs_factor = val;
636 EXPORT_SYMBOL(lprocfs_quota_wr_qs_factor);
638 struct lprocfs_vars lprocfs_quota_common_vars[] = {
639 { "quota_bunit_sz", lprocfs_quota_rd_bunit,
640 lprocfs_quota_wr_bunit, 0},
641 { "quota_btune_sz", lprocfs_quota_rd_btune,
642 lprocfs_quota_wr_btune, 0},
643 { "quota_iunit_sz", lprocfs_quota_rd_iunit,
644 lprocfs_quota_wr_iunit, 0},
645 { "quota_itune_sz", lprocfs_quota_rd_itune,
646 lprocfs_quota_wr_itune, 0},
647 { "quota_type", lprocfs_quota_rd_type,
648 lprocfs_quota_wr_type, 0},
649 { "quota_switch_seconds", lprocfs_quota_rd_switch_seconds,
650 lprocfs_quota_wr_switch_seconds, 0 },
651 { "quota_sync_blk", lprocfs_quota_rd_sync_blk,
652 lprocfs_quota_wr_sync_blk, 0},
656 struct lprocfs_vars lprocfs_quota_master_vars[] = {
657 { "quota_switch_qs", lprocfs_quota_rd_switch_qs,
658 lprocfs_quota_wr_switch_qs, 0 },
659 { "quota_boundary_factor", lprocfs_quota_rd_boundary_factor,
660 lprocfs_quota_wr_boundary_factor, 0 },
661 { "quota_least_bunit", lprocfs_quota_rd_least_bunit,
662 lprocfs_quota_wr_least_bunit, 0 },
663 { "quota_least_iunit", lprocfs_quota_rd_least_iunit,
664 lprocfs_quota_wr_least_iunit, 0 },
665 { "quota_qs_factor", lprocfs_quota_rd_qs_factor,
666 lprocfs_quota_wr_qs_factor, 0 },
670 int lquota_proc_setup(struct obd_device *obd, int is_master)
672 struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt;
676 LASSERT(lquota_type_proc_dir && obd);
677 qctxt->lqc_proc_dir = lprocfs_register(obd->obd_name,
678 lquota_type_proc_dir,
679 lprocfs_quota_common_vars, obd);
680 if (IS_ERR(qctxt->lqc_proc_dir)) {
681 rc = PTR_ERR(qctxt->lqc_proc_dir);
682 CERROR("error %d setting up lprocfs for %s\n", rc,
684 qctxt->lqc_proc_dir = NULL;
689 rc = lprocfs_add_vars(qctxt->lqc_proc_dir,
690 lprocfs_quota_master_vars, obd);
692 CERROR("error %d setting up lprocfs for %s"
693 "(quota master)\n", rc, obd->obd_name);
694 GOTO(out_free_proc, rc);
698 qctxt->lqc_stats = lprocfs_alloc_stats(LQUOTA_LAST_STAT -
699 LQUOTA_FIRST_STAT, 0);
700 if (!qctxt->lqc_stats)
701 GOTO(out_free_proc, rc = -ENOMEM);
703 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_SYNC_ACQ,
704 LPROCFS_CNTR_AVGMINMAX, "sync_acq_req", "us");
705 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_SYNC_REL,
706 LPROCFS_CNTR_AVGMINMAX, "sync_rel_req", "us");
707 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_ASYNC_ACQ,
708 LPROCFS_CNTR_AVGMINMAX, "async_acq_req", "us");
709 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_ASYNC_REL,
710 LPROCFS_CNTR_AVGMINMAX, "async_rel_req", "us");
712 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_FOR_CHK_BLK,
713 LPROCFS_CNTR_AVGMINMAX,
714 "wait_for_blk_quota(lquota_chkquota)", "us");
715 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_FOR_CHK_INO,
716 LPROCFS_CNTR_AVGMINMAX,
717 "wait_for_ino_quota(lquota_chkquota)", "us");
718 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_FOR_COMMIT_BLK,
719 LPROCFS_CNTR_AVGMINMAX,
720 "wait_for_blk_quota(lquota_pending_commit)",
722 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_FOR_COMMIT_INO,
723 LPROCFS_CNTR_AVGMINMAX,
724 "wait_for_ino_quota(lquota_pending_commit)",
727 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_PENDING_BLK_QUOTA,
728 LPROCFS_CNTR_AVGMINMAX,
729 "wait_for_pending_blk_quota_req"
730 "(qctxt_wait_pending_dqacq)", "us");
731 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_WAIT_PENDING_INO_QUOTA,
732 LPROCFS_CNTR_AVGMINMAX,
733 "wait_for_pending_ino_quota_req"
734 "(qctxt_wait_pending_dqacq)", "us");
735 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_NOWAIT_PENDING_BLK_QUOTA,
736 LPROCFS_CNTR_AVGMINMAX,
737 "nowait_for_pending_blk_quota_req"
738 "(qctxt_wait_pending_dqacq)", "us");
739 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_NOWAIT_PENDING_INO_QUOTA,
740 LPROCFS_CNTR_AVGMINMAX,
741 "nowait_for_pending_ino_quota_req"
742 "(qctxt_wait_pending_dqacq)", "us");
744 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_QUOTA_CTL,
745 LPROCFS_CNTR_AVGMINMAX, "quota_ctl", "us");
746 lprocfs_counter_init(qctxt->lqc_stats, LQUOTA_ADJUST_QUNIT,
747 LPROCFS_CNTR_AVGMINMAX, "adjust_qunit", "us");
749 lprocfs_register_stats(qctxt->lqc_proc_dir, "stats", qctxt->lqc_stats);
754 lprocfs_remove(&qctxt->lqc_proc_dir);
759 int lquota_proc_cleanup(struct lustre_quota_ctxt *qctxt)
761 if (!qctxt || !qctxt->lqc_proc_dir)
764 if (qctxt->lqc_stats != NULL)
765 lprocfs_free_stats(&qctxt->lqc_stats);
767 lprocfs_remove(&qctxt->lqc_proc_dir);