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.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2012, 2017, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
32 * lustre/ofd/lproc_ofd.c
34 * This file provides functions of procfs interface for OBD Filter Device (OFD).
36 * Author: Andreas Dilger <andreas.dilger@intel.com>
37 * Author: Mikhail Pershin <mike.pershin@intel.com>
38 * Author: Johann Lombardi <johann.lombardi@intel.com>
39 * Author: Fan Yong <fan.yong@intel.com>
42 #define DEBUG_SUBSYSTEM S_CLASS
45 #include <lprocfs_status.h>
46 #include <linux/seq_file.h>
47 #include <lustre_lfsck.h>
49 #include "ofd_internal.h"
54 * Show number of FID allocation sequences.
56 * \param[in] m seq_file handle
57 * \param[in] data unused for single entry
59 * \retval 0 on success
60 * \retval negative value on error
62 static int ofd_seqs_seq_show(struct seq_file *m, void *data)
64 struct obd_device *obd = m->private;
65 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
67 seq_printf(m, "%u\n", ofd->ofd_seq_count);
70 LPROC_SEQ_FOPS_RO(ofd_seqs);
73 * Show total number of grants for precreate.
75 * \param[in] m seq_file handle
76 * \param[in] data unused for single entry
78 * \retval 0 on success
79 * \retval negative value on error
81 static int ofd_grant_precreate_seq_show(struct seq_file *m, void *data)
83 struct obd_device *obd = m->private;
86 seq_printf(m, "%ld\n",
87 obd->obd_self_export->exp_target_data.ted_grant);
90 LPROC_SEQ_FOPS_RO(ofd_grant_precreate);
93 * Show number of precreates allowed in a single transaction.
95 * \param[in] m seq_file handle
96 * \param[in] data unused for single entry
98 * \retval 0 on success
99 * \retval negative value on error
101 static int ofd_precreate_batch_seq_show(struct seq_file *m, void *data)
103 struct obd_device *obd = m->private;
104 struct ofd_device *ofd;
106 LASSERT(obd != NULL);
107 ofd = ofd_dev(obd->obd_lu_dev);
108 seq_printf(m, "%d\n", ofd->ofd_precreate_batch);
113 * Change number of precreates allowed in a single transaction.
115 * \param[in] file proc file
116 * \param[in] buffer string which represents maximum number
117 * \param[in] count \a buffer length
118 * \param[in] off unused for single entry
120 * \retval \a count on success
121 * \retval negative number on error
124 ofd_precreate_batch_seq_write(struct file *file, const char __user *buffer,
125 size_t count, loff_t *off)
127 struct seq_file *m = file->private_data;
128 struct obd_device *obd = m->private;
129 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
133 rc = lprocfs_str_to_s64(buffer, count, &val);
137 if (val < 1 || val > INT_MAX)
140 spin_lock(&ofd->ofd_batch_lock);
141 ofd->ofd_precreate_batch = val;
142 spin_unlock(&ofd->ofd_batch_lock);
145 LPROC_SEQ_FOPS(ofd_precreate_batch);
148 * Show the last used ID for each FID sequence used by OFD.
150 * \param[in] m seq_file handle
151 * \param[in] data unused for single entry
153 * \retval 0 on success
154 * \retval negative value on error
156 static int ofd_last_id_seq_show(struct seq_file *m, void *data)
158 struct obd_device *obd = m->private;
159 struct ofd_device *ofd;
160 struct ofd_seq *oseq = NULL;
165 ofd = ofd_dev(obd->obd_lu_dev);
167 read_lock(&ofd->ofd_seq_list_lock);
168 list_for_each_entry(oseq, &ofd->ofd_seq_list, os_list) {
171 seq = ostid_seq(&oseq->os_oi) == 0 ?
172 fid_idif_seq(ostid_id(&oseq->os_oi),
173 ofd->ofd_lut.lut_lsd.lsd_osd_index) :
174 ostid_seq(&oseq->os_oi);
175 seq_printf(m, DOSTID"\n", seq, ostid_id(&oseq->os_oi));
177 read_unlock(&ofd->ofd_seq_list_lock);
180 LPROC_SEQ_FOPS_RO(ofd_last_id);
183 * Show maximum number of Filter Modification Data (FMD) maintained by OFD.
185 * \param[in] m seq_file handle
186 * \param[in] data unused for single entry
188 * \retval 0 on success
189 * \retval negative value on error
191 static int ofd_fmd_max_num_seq_show(struct seq_file *m, void *data)
193 struct obd_device *obd = m->private;
194 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
196 seq_printf(m, "%u\n", ofd->ofd_fmd_max_num);
201 * Change number of FMDs maintained by OFD.
203 * This defines how large the list of FMDs can be.
205 * \param[in] file proc file
206 * \param[in] buffer string which represents maximum number
207 * \param[in] count \a buffer length
208 * \param[in] off unused for single entry
210 * \retval \a count on success
211 * \retval negative number on error
214 ofd_fmd_max_num_seq_write(struct file *file, const char __user *buffer,
215 size_t count, loff_t *off)
217 struct seq_file *m = file->private_data;
218 struct obd_device *obd = m->private;
219 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
223 rc = lprocfs_str_to_s64(buffer, count, &val);
227 if (val > 65536 || val < 1)
230 ofd->ofd_fmd_max_num = val;
233 LPROC_SEQ_FOPS(ofd_fmd_max_num);
236 * Show the maximum age of FMD data in seconds.
238 * \param[in] m seq_file handle
239 * \param[in] data unused for single entry
241 * \retval 0 on success
242 * \retval negative value on error
244 static int ofd_fmd_max_age_seq_show(struct seq_file *m, void *data)
246 struct obd_device *obd = m->private;
247 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
249 seq_printf(m, "%lld\n", ofd->ofd_fmd_max_age);
254 * Set the maximum age of FMD data in seconds.
256 * This defines how long FMD data stays in the FMD list.
258 * \param[in] file proc file
259 * \param[in] buffer string which represents maximum number
260 * \param[in] count \a buffer length
261 * \param[in] off unused for single entry
263 * \retval \a count on success
264 * \retval negative number on error
267 ofd_fmd_max_age_seq_write(struct file *file, const char __user *buffer,
268 size_t count, loff_t *off)
270 struct seq_file *m = file->private_data;
271 struct obd_device *obd = m->private;
272 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
276 rc = lprocfs_str_to_s64(buffer, count, &val);
280 if (val > 65536 || val < 1)
283 ofd->ofd_fmd_max_age = val;
286 LPROC_SEQ_FOPS(ofd_fmd_max_age);
289 * Show if the OFD is in degraded mode.
291 * Degraded means OFD has a failed drive or is undergoing RAID rebuild.
292 * The MDS will try to avoid using this OST for new object allocations
293 * to reduce the impact to global IO performance when clients writing to
294 * this OST are slowed down. It also reduces the contention on the OST
295 * RAID device, allowing it to rebuild more quickly.
297 * \param[in] m seq_file handle
298 * \param[in] data unused for single entry
300 * \retval 0 on success
301 * \retval negative value on error
303 static int ofd_degraded_seq_show(struct seq_file *m, void *data)
305 struct obd_device *obd = m->private;
306 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
308 seq_printf(m, "%u\n", ofd->ofd_raid_degraded);
313 * Set OFD to degraded mode.
315 * This is used to interface to userspace administrative tools for
316 * the underlying RAID storage, so that they can mark an OST
317 * as having degraded performance.
319 * \param[in] file proc file
320 * \param[in] buffer string which represents mode
321 * 1: set degraded mode
322 * 0: unset degraded mode
323 * \param[in] count \a buffer length
324 * \param[in] off unused for single entry
326 * \retval \a count on success
327 * \retval negative number on error
330 ofd_degraded_seq_write(struct file *file, const char __user *buffer,
331 size_t count, loff_t *off)
333 struct seq_file *m = file->private_data;
334 struct obd_device *obd = m->private;
335 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
339 rc = lprocfs_str_to_s64(buffer, count, &val);
343 spin_lock(&ofd->ofd_flags_lock);
344 ofd->ofd_raid_degraded = !!val;
345 spin_unlock(&ofd->ofd_flags_lock);
348 LPROC_SEQ_FOPS(ofd_degraded);
351 * Show OFD filesystem type.
353 * \param[in] m seq_file handle
354 * \param[in] data unused for single entry
356 * \retval 0 on success
357 * \retval negative value on error
359 static int ofd_fstype_seq_show(struct seq_file *m, void *data)
361 struct obd_device *obd = m->private;
362 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
365 LASSERT(ofd->ofd_osd);
366 d = &ofd->ofd_osd->dd_lu_dev;
368 seq_printf(m, "%s\n", d->ld_type->ldt_name);
371 LPROC_SEQ_FOPS_RO(ofd_fstype);
374 * Show journal handling mode: synchronous or asynchronous.
376 * When running in asynchronous mode the journal transactions are not
377 * committed to disk before the RPC is replied back to the client.
378 * This will typically improve client performance when only a small number
379 * of clients are writing, since the client(s) can have more write RPCs
380 * in flight. However, it also means that the client has to handle recovery
381 * on bulk RPCs, and will have to keep more dirty pages in cache before they
382 * are committed on the OST.
384 * \param[in] m seq_file handle
385 * \param[in] data unused for single entry
387 * \retval 0 on success
388 * \retval negative value on error
390 static int ofd_syncjournal_seq_show(struct seq_file *m, void *data)
392 struct obd_device *obd = m->private;
393 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
395 seq_printf(m, "%u\n", ofd->ofd_syncjournal);
400 * Set journal mode to synchronous or asynchronous.
402 * \param[in] file proc file
403 * \param[in] buffer string which represents mode
404 * 1: synchronous mode
405 * 0: asynchronous mode
406 * \param[in] count \a buffer length
407 * \param[in] off unused for single entry
409 * \retval \a count on success
410 * \retval negative number on error
413 ofd_syncjournal_seq_write(struct file *file, const char __user *buffer,
414 size_t count, loff_t *off)
416 struct seq_file *m = file->private_data;
417 struct obd_device *obd = m->private;
418 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
422 rc = lprocfs_str_to_s64(buffer, count, &val);
429 spin_lock(&ofd->ofd_flags_lock);
430 ofd->ofd_syncjournal = !!val;
432 spin_unlock(&ofd->ofd_flags_lock);
436 LPROC_SEQ_FOPS(ofd_syncjournal);
438 /* This must be longer than the longest string below */
439 #define SYNC_STATES_MAXLEN 16
441 static int ofd_brw_size_seq_show(struct seq_file *m, void *data)
443 struct obd_device *obd = m->private;
444 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
446 seq_printf(m, "%u\n", ofd->ofd_brw_size / ONE_MB_BRW_SIZE);
451 ofd_brw_size_seq_write(struct file *file, const char __user *buffer,
452 size_t count, loff_t *off)
454 struct seq_file *m = file->private_data;
455 struct obd_device *obd = m->private;
456 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
460 rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
467 if (val > DT_MAX_BRW_SIZE ||
468 val < (1 << ofd->ofd_lut.lut_tgd.tgd_blockbits))
471 spin_lock(&ofd->ofd_flags_lock);
472 ofd->ofd_brw_size = val;
473 spin_unlock(&ofd->ofd_flags_lock);
477 LPROC_SEQ_FOPS(ofd_brw_size);
479 static char *sync_on_cancel_states[] = {"never",
484 * Show OFD policy for handling dirty data under a lock being cancelled.
486 * \param[in] m seq_file handle
487 * \param[in] data unused for single entry
489 * \retval 0 on success
490 * \retval negative value on error
492 static int ofd_sync_lock_cancel_seq_show(struct seq_file *m, void *data)
494 struct obd_device *obd = m->private;
495 struct lu_target *tgt = obd->u.obt.obt_lut;
497 seq_printf(m, "%s\n",
498 sync_on_cancel_states[tgt->lut_sync_lock_cancel]);
503 * Change OFD policy for handling dirty data under a lock being cancelled.
505 * This variable defines what action OFD takes upon lock cancel
506 * There are three possible modes:
507 * 1) never - never do sync upon lock cancel. This can lead to data
508 * inconsistencies if both the OST and client crash while writing a file
509 * that is also concurrently being read by another client. In these cases,
510 * this may allow the file data to "rewind" to an earlier state.
511 * 2) blocking - do sync only if there is blocking lock, e.g. if another
512 * client is trying to access this same object
513 * 3) always - do sync always
515 * \param[in] file proc file
516 * \param[in] buffer string which represents policy
517 * \param[in] count \a buffer length
518 * \param[in] off unused for single entry
520 * \retval \a count on success
521 * \retval negative number on error
524 ofd_sync_lock_cancel_seq_write(struct file *file, const char __user *buffer,
525 size_t count, loff_t *off)
527 struct seq_file *m = file->private_data;
528 struct obd_device *obd = m->private;
529 struct lu_target *tgt = obd->u.obt.obt_lut;
530 char kernbuf[SYNC_STATES_MAXLEN];
534 if (count == 0 || count >= sizeof(kernbuf))
537 if (copy_from_user(kernbuf, buffer, count))
541 if (kernbuf[count - 1] == '\n')
542 kernbuf[count - 1] = 0;
544 for (i = 0 ; i < NUM_SYNC_ON_CANCEL_STATES; i++) {
545 if (strcmp(kernbuf, sync_on_cancel_states[i]) == 0) {
551 /* Legacy numeric codes */
553 int rc = lprocfs_str_to_s64(buffer, count, &val);
558 if (val < 0 || val > 2)
561 spin_lock(&tgt->lut_flags_lock);
562 tgt->lut_sync_lock_cancel = val;
563 spin_unlock(&tgt->lut_flags_lock);
566 LPROC_SEQ_FOPS(ofd_sync_lock_cancel);
569 * Show the limit of soft sync RPCs.
571 * This value defines how many IO RPCs with OBD_BRW_SOFT_SYNC flag
572 * are allowed before sync update will be triggered.
574 * \param[in] m seq_file handle
575 * \param[in] data unused for single entry
577 * \retval 0 on success
578 * \retval negative value on error
580 static int ofd_soft_sync_limit_seq_show(struct seq_file *m, void *data)
582 struct obd_device *obd = m->private;
583 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
585 return lprocfs_uint_seq_show(m, &ofd->ofd_soft_sync_limit);
589 * Change the limit of soft sync RPCs.
591 * Define how many IO RPCs with OBD_BRW_SOFT_SYNC flag
592 * allowed before sync update will be done.
594 * This limit is global across all exports.
596 * \param[in] file proc file
597 * \param[in] buffer string which represents limit
598 * \param[in] count \a buffer length
599 * \param[in] off unused for single entry
601 * \retval \a count on success
602 * \retval negative number on error
605 ofd_soft_sync_limit_seq_write(struct file *file, const char __user *buffer,
606 size_t count, loff_t *off)
608 struct seq_file *m = file->private_data;
609 struct obd_device *obd = m->private;
610 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
612 return lprocfs_uint_seq_write(file, buffer, count,
613 (loff_t *) &ofd->ofd_soft_sync_limit);
615 LPROC_SEQ_FOPS(ofd_soft_sync_limit);
618 * Show the LFSCK speed limit.
620 * The maximum number of items scanned per second.
622 * \param[in] m seq_file handle
623 * \param[in] data unused for single entry
625 * \retval 0 on success
626 * \retval negative value on error
628 static int ofd_lfsck_speed_limit_seq_show(struct seq_file *m, void *data)
630 struct obd_device *obd = m->private;
631 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
633 return lfsck_get_speed(m, ofd->ofd_osd);
637 * Change the LFSCK speed limit.
639 * Limit number of items that may be scanned per second.
641 * \param[in] file proc file
642 * \param[in] buffer string which represents limit
643 * \param[in] count \a buffer length
644 * \param[in] off unused for single entry
646 * \retval \a count on success
647 * \retval negative number on error
650 ofd_lfsck_speed_limit_seq_write(struct file *file, const char __user *buffer,
651 size_t count, loff_t *off)
653 struct seq_file *m = file->private_data;
654 struct obd_device *obd = m->private;
655 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
659 rc = lprocfs_str_to_s64(buffer, count, &val);
666 rc = lfsck_set_speed(ofd->ofd_osd, val);
668 return rc != 0 ? rc : count;
670 LPROC_SEQ_FOPS(ofd_lfsck_speed_limit);
673 * Show LFSCK layout verification stats from the most recent LFSCK run.
675 * \param[in] m seq_file handle
676 * \param[in] data unused for single entry
678 * \retval 0 on success
679 * \retval negative value on error
681 static int ofd_lfsck_layout_seq_show(struct seq_file *m, void *data)
683 struct obd_device *obd = m->private;
684 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
686 return lfsck_dump(m, ofd->ofd_osd, LFSCK_TYPE_LAYOUT);
688 LPROC_SEQ_FOPS_RO(ofd_lfsck_layout);
691 * Show if LFSCK performed parent FID verification.
693 * \param[in] m seq_file handle
694 * \param[in] data unused for single entry
696 * \retval 0 on success
697 * \retval negative value on error
699 static int ofd_lfsck_verify_pfid_seq_show(struct seq_file *m, void *data)
701 struct obd_device *obd = m->private;
702 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
704 seq_printf(m, "switch: %s\ndetected: %llu\nrepaired: %llu\n",
705 ofd->ofd_lfsck_verify_pfid ? "on" : "off",
706 ofd->ofd_inconsistency_self_detected,
707 ofd->ofd_inconsistency_self_repaired);
712 * Set the LFSCK behavior to verify parent FID correctness.
714 * If flag ofd_lfsck_verify_pfid is set then LFSCK does parent FID
715 * verification during read/write operations.
717 * \param[in] file proc file
718 * \param[in] buffer string which represents behavior
719 * 1: verify parent FID
720 * 0: don't verify parent FID
721 * \param[in] count \a buffer length
722 * \param[in] off unused for single entry
724 * \retval \a count on success
725 * \retval negative number on error
728 ofd_lfsck_verify_pfid_seq_write(struct file *file, const char __user *buffer,
729 size_t count, loff_t *off)
731 struct seq_file *m = file->private_data;
732 struct obd_device *obd = m->private;
733 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
737 rc = lprocfs_str_to_s64(buffer, count, &val);
741 ofd->ofd_lfsck_verify_pfid = !!val;
742 if (!ofd->ofd_lfsck_verify_pfid) {
743 ofd->ofd_inconsistency_self_detected = 0;
744 ofd->ofd_inconsistency_self_repaired = 0;
749 LPROC_SEQ_FOPS(ofd_lfsck_verify_pfid);
751 static int ofd_site_stats_seq_show(struct seq_file *m, void *data)
753 struct obd_device *obd = m->private;
755 return lu_site_stats_seq_print(obd->obd_lu_dev->ld_site, m);
757 LPROC_SEQ_FOPS_RO(ofd_site_stats);
759 LPROC_SEQ_FOPS_RO_TYPE(ofd, recovery_status);
760 LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_soft);
761 LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_hard);
762 LPROC_SEQ_FOPS_WR_ONLY(ofd, evict_client);
763 LPROC_SEQ_FOPS_RO_TYPE(ofd, num_exports);
764 LPROC_SEQ_FOPS_RO_TYPE(ofd, target_instance);
765 LPROC_SEQ_FOPS_RW_TYPE(ofd, ir_factor);
766 LPROC_SEQ_FOPS_RW_TYPE(ofd, checksum_dump);
767 LPROC_SEQ_FOPS_RW_TYPE(ofd, job_interval);
769 LPROC_SEQ_FOPS_RO(tgt_tot_dirty);
770 LPROC_SEQ_FOPS_RO(tgt_tot_granted);
771 LPROC_SEQ_FOPS_RO(tgt_tot_pending);
772 LPROC_SEQ_FOPS(tgt_grant_compat_disable);
774 struct lprocfs_vars lprocfs_ofd_obd_vars[] = {
775 { .name = "seqs_allocated",
776 .fops = &ofd_seqs_fops },
778 .fops = &ofd_fstype_fops },
780 .fops = &ofd_last_id_fops },
781 { .name = "tot_dirty",
782 .fops = &tgt_tot_dirty_fops },
783 { .name = "tot_pending",
784 .fops = &tgt_tot_pending_fops },
785 { .name = "tot_granted",
786 .fops = &tgt_tot_granted_fops },
787 { .name = "grant_precreate",
788 .fops = &ofd_grant_precreate_fops },
789 { .name = "precreate_batch",
790 .fops = &ofd_precreate_batch_fops },
791 { .name = "recovery_status",
792 .fops = &ofd_recovery_status_fops },
793 { .name = "recovery_time_soft",
794 .fops = &ofd_recovery_time_soft_fops },
795 { .name = "recovery_time_hard",
796 .fops = &ofd_recovery_time_hard_fops },
797 { .name = "evict_client",
798 .fops = &ofd_evict_client_fops },
799 { .name = "num_exports",
800 .fops = &ofd_num_exports_fops },
801 { .name = "degraded",
802 .fops = &ofd_degraded_fops },
803 { .name = "sync_journal",
804 .fops = &ofd_syncjournal_fops },
805 { .name = "brw_size",
806 .fops = &ofd_brw_size_fops },
807 { .name = "sync_on_lock_cancel",
808 .fops = &ofd_sync_lock_cancel_fops },
809 { .name = "instance",
810 .fops = &ofd_target_instance_fops },
811 { .name = "ir_factor",
812 .fops = &ofd_ir_factor_fops },
813 { .name = "checksum_dump",
814 .fops = &ofd_checksum_dump_fops },
815 { .name = "grant_compat_disable",
816 .fops = &tgt_grant_compat_disable_fops },
817 { .name = "client_cache_count",
818 .fops = &ofd_fmd_max_num_fops },
819 { .name = "client_cache_seconds",
820 .fops = &ofd_fmd_max_age_fops },
821 { .name = "job_cleanup_interval",
822 .fops = &ofd_job_interval_fops },
823 { .name = "soft_sync_limit",
824 .fops = &ofd_soft_sync_limit_fops },
825 { .name = "lfsck_speed_limit",
826 .fops = &ofd_lfsck_speed_limit_fops },
827 { .name = "lfsck_layout",
828 .fops = &ofd_lfsck_layout_fops },
829 { .name = "lfsck_verify_pfid",
830 .fops = &ofd_lfsck_verify_pfid_fops },
831 { .name = "site_stats",
832 .fops = &ofd_site_stats_fops },
837 * Initialize OFD statistics counters
839 * param[in] stats statistics counters
841 void ofd_stats_counter_init(struct lprocfs_stats *stats)
843 LASSERT(stats && stats->ls_num >= LPROC_OFD_STATS_LAST);
845 lprocfs_counter_init(stats, LPROC_OFD_STATS_READ,
846 LPROCFS_CNTR_AVGMINMAX, "read_bytes", "bytes");
847 lprocfs_counter_init(stats, LPROC_OFD_STATS_WRITE,
848 LPROCFS_CNTR_AVGMINMAX, "write_bytes", "bytes");
849 lprocfs_counter_init(stats, LPROC_OFD_STATS_GETATTR,
850 0, "getattr", "reqs");
851 lprocfs_counter_init(stats, LPROC_OFD_STATS_SETATTR,
852 0, "setattr", "reqs");
853 lprocfs_counter_init(stats, LPROC_OFD_STATS_PUNCH,
855 lprocfs_counter_init(stats, LPROC_OFD_STATS_SYNC,
857 lprocfs_counter_init(stats, LPROC_OFD_STATS_DESTROY,
858 0, "destroy", "reqs");
859 lprocfs_counter_init(stats, LPROC_OFD_STATS_CREATE,
860 0, "create", "reqs");
861 lprocfs_counter_init(stats, LPROC_OFD_STATS_STATFS,
862 0, "statfs", "reqs");
863 lprocfs_counter_init(stats, LPROC_OFD_STATS_GET_INFO,
864 0, "get_info", "reqs");
865 lprocfs_counter_init(stats, LPROC_OFD_STATS_SET_INFO,
866 0, "set_info", "reqs");
867 lprocfs_counter_init(stats, LPROC_OFD_STATS_QUOTACTL,
868 0, "quotactl", "reqs");
871 #endif /* CONFIG_PROC_FS */