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, 2014 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 return seq_printf(m, "%u\n", ofd->ofd_seq_count);
69 LPROC_SEQ_FOPS_RO(ofd_seqs);
72 * Show estimate of total amount of dirty data on clients.
74 * \param[in] m seq_file handle
75 * \param[in] data unused for single entry
77 * \retval 0 on success
78 * \retval negative value on error
80 static int ofd_tot_dirty_seq_show(struct seq_file *m, void *data)
82 struct obd_device *obd = m->private;
83 struct ofd_device *ofd;
86 ofd = ofd_dev(obd->obd_lu_dev);
87 return seq_printf(m, LPU64"\n", ofd->ofd_tot_dirty);
89 LPROC_SEQ_FOPS_RO(ofd_tot_dirty);
92 * Show total amount of space granted to clients.
94 * \param[in] m seq_file handle
95 * \param[in] data unused for single entry
97 * \retval 0 on success
98 * \retval negative value on error
100 static int ofd_tot_granted_seq_show(struct seq_file *m, void *data)
102 struct obd_device *obd = m->private;
103 struct ofd_device *ofd;
105 LASSERT(obd != NULL);
106 ofd = ofd_dev(obd->obd_lu_dev);
107 return seq_printf(m, LPU64"\n", ofd->ofd_tot_granted);
109 LPROC_SEQ_FOPS_RO(ofd_tot_granted);
112 * Show total amount of space used by IO in progress.
114 * \param[in] m seq_file handle
115 * \param[in] data unused for single entry
117 * \retval 0 on success
118 * \retval negative value on error
120 static int ofd_tot_pending_seq_show(struct seq_file *m, void *data)
122 struct obd_device *obd = m->private;
123 struct ofd_device *ofd;
125 LASSERT(obd != NULL);
126 ofd = ofd_dev(obd->obd_lu_dev);
127 return seq_printf(m, LPU64"\n", ofd->ofd_tot_pending);
129 LPROC_SEQ_FOPS_RO(ofd_tot_pending);
132 * Show total number of grants for precreate.
134 * \param[in] m seq_file handle
135 * \param[in] data unused for single entry
137 * \retval 0 on success
138 * \retval negative value on error
140 static int ofd_grant_precreate_seq_show(struct seq_file *m, void *data)
142 struct obd_device *obd = m->private;
144 LASSERT(obd != NULL);
145 return seq_printf(m, "%ld\n",
146 obd->obd_self_export->exp_filter_data.fed_grant);
148 LPROC_SEQ_FOPS_RO(ofd_grant_precreate);
151 * Show number of precreates allowed in a single transaction.
153 * \param[in] m seq_file handle
154 * \param[in] data unused for single entry
156 * \retval 0 on success
157 * \retval negative value on error
159 static int ofd_precreate_batch_seq_show(struct seq_file *m, void *data)
161 struct obd_device *obd = m->private;
162 struct ofd_device *ofd;
164 LASSERT(obd != NULL);
165 ofd = ofd_dev(obd->obd_lu_dev);
166 return seq_printf(m, "%d\n", ofd->ofd_precreate_batch);
170 * Change number of precreates allowed in a single transaction.
172 * \param[in] file proc file
173 * \param[in] buffer string which represents maximum number
174 * \param[in] count \a buffer length
175 * \param[in] off unused for single entry
177 * \retval \a count on success
178 * \retval negative number on error
181 ofd_precreate_batch_seq_write(struct file *file, const char __user *buffer,
182 size_t count, loff_t *off)
184 struct seq_file *m = file->private_data;
185 struct obd_device *obd = m->private;
186 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
190 rc = lprocfs_write_helper(buffer, count, &val);
197 spin_lock(&ofd->ofd_batch_lock);
198 ofd->ofd_precreate_batch = val;
199 spin_unlock(&ofd->ofd_batch_lock);
202 LPROC_SEQ_FOPS(ofd_precreate_batch);
205 * Show the last used ID for each FID sequence used by OFD.
207 * \param[in] m seq_file handle
208 * \param[in] data unused for single entry
210 * \retval 0 on success
211 * \retval negative value on error
213 static int ofd_last_id_seq_show(struct seq_file *m, void *data)
215 struct obd_device *obd = m->private;
216 struct ofd_device *ofd;
217 struct ofd_seq *oseq = NULL;
223 ofd = ofd_dev(obd->obd_lu_dev);
225 read_lock(&ofd->ofd_seq_list_lock);
226 list_for_each_entry(oseq, &ofd->ofd_seq_list, os_list) {
229 seq = ostid_seq(&oseq->os_oi) == 0 ?
230 fid_idif_seq(ostid_id(&oseq->os_oi),
231 ofd->ofd_lut.lut_lsd.lsd_osd_index) :
232 ostid_seq(&oseq->os_oi);
233 rc = seq_printf(m, DOSTID"\n", seq, ostid_id(&oseq->os_oi));
240 read_unlock(&ofd->ofd_seq_list_lock);
243 LPROC_SEQ_FOPS_RO(ofd_last_id);
246 * Show maximum number of Filter Modification Data (FMD) maintained by OFD.
248 * \param[in] m seq_file handle
249 * \param[in] data unused for single entry
251 * \retval 0 on success
252 * \retval negative value on error
254 static int ofd_fmd_max_num_seq_show(struct seq_file *m, void *data)
256 struct obd_device *obd = m->private;
257 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
259 return seq_printf(m, "%u\n", ofd->ofd_fmd_max_num);
263 * Change number of FMDs maintained by OFD.
265 * This defines how large the list of FMDs can be.
267 * \param[in] file proc file
268 * \param[in] buffer string which represents maximum number
269 * \param[in] count \a buffer length
270 * \param[in] off unused for single entry
272 * \retval \a count on success
273 * \retval negative number on error
276 ofd_fmd_max_num_seq_write(struct file *file, const char __user *buffer,
277 size_t count, loff_t *off)
279 struct seq_file *m = file->private_data;
280 struct obd_device *obd = m->private;
281 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
285 rc = lprocfs_write_helper(buffer, count, &val);
289 if (val > 65536 || val < 1)
292 ofd->ofd_fmd_max_num = val;
295 LPROC_SEQ_FOPS(ofd_fmd_max_num);
298 * Show the maximum age of FMD data in seconds.
300 * Though it is shown in seconds, it is stored internally in units
301 * of jiffies for efficiency.
303 * \param[in] m seq_file handle
304 * \param[in] data unused for single entry
306 * \retval 0 on success
307 * \retval negative value on error
309 static int ofd_fmd_max_age_seq_show(struct seq_file *m, void *data)
311 struct obd_device *obd = m->private;
312 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
314 return seq_printf(m, "%ld\n", jiffies_to_msecs(ofd->ofd_fmd_max_age) /
319 * Set the maximum age of FMD data in seconds.
321 * This defines how long FMD data stays in the FMD list.
322 * It is stored internally in units of jiffies for efficiency.
324 * \param[in] file proc file
325 * \param[in] buffer string which represents maximum number
326 * \param[in] count \a buffer length
327 * \param[in] off unused for single entry
329 * \retval \a count on success
330 * \retval negative number on error
333 ofd_fmd_max_age_seq_write(struct file *file, const char __user *buffer,
334 size_t count, loff_t *off)
336 struct seq_file *m = file->private_data;
337 struct obd_device *obd = m->private;
338 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
342 rc = lprocfs_write_helper(buffer, count, &val);
346 if (val > 65536 || val < 1)
349 ofd->ofd_fmd_max_age = msecs_to_jiffies(val * MSEC_PER_SEC);
352 LPROC_SEQ_FOPS(ofd_fmd_max_age);
355 * Show if the OFD is in degraded mode.
357 * Degraded means OFD has a failed drive or is undergoing RAID rebuild.
358 * The MDS will try to avoid using this OST for new object allocations
359 * to reduce the impact to global IO performance when clients writing to
360 * this OST are slowed down. It also reduces the contention on the OST
361 * RAID device, allowing it to rebuild more quickly.
363 * \param[in] m seq_file handle
364 * \param[in] data unused for single entry
366 * \retval 0 on success
367 * \retval negative value on error
369 static int ofd_degraded_seq_show(struct seq_file *m, void *data)
371 struct obd_device *obd = m->private;
372 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
374 return seq_printf(m, "%u\n", ofd->ofd_raid_degraded);
378 * Set OFD to degraded mode.
380 * This is used to interface to userspace administrative tools for
381 * the underlying RAID storage, so that they can mark an OST
382 * as having degraded performance.
384 * \param[in] file proc file
385 * \param[in] buffer string which represents mode
386 * 1: set degraded mode
387 * 0: unset degraded mode
388 * \param[in] count \a buffer length
389 * \param[in] off unused for single entry
391 * \retval \a count on success
392 * \retval negative number on error
395 ofd_degraded_seq_write(struct file *file, const char __user *buffer,
396 size_t count, loff_t *off)
398 struct seq_file *m = file->private_data;
399 struct obd_device *obd = m->private;
400 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
403 rc = lprocfs_write_helper(buffer, count, &val);
407 spin_lock(&ofd->ofd_flags_lock);
408 ofd->ofd_raid_degraded = !!val;
409 spin_unlock(&ofd->ofd_flags_lock);
412 LPROC_SEQ_FOPS(ofd_degraded);
415 * Show OFD filesystem type.
417 * \param[in] m seq_file handle
418 * \param[in] data unused for single entry
420 * \retval 0 on success
421 * \retval negative value on error
423 static int ofd_fstype_seq_show(struct seq_file *m, void *data)
425 struct obd_device *obd = m->private;
426 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
429 LASSERT(ofd->ofd_osd);
430 d = &ofd->ofd_osd->dd_lu_dev;
432 return seq_printf(m, "%s\n", d->ld_type->ldt_name);
434 LPROC_SEQ_FOPS_RO(ofd_fstype);
437 * Show journal handling mode: synchronous or asynchronous.
439 * When running in asynchronous mode the journal transactions are not
440 * committed to disk before the RPC is replied back to the client.
441 * This will typically improve client performance when only a small number
442 * of clients are writing, since the client(s) can have more write RPCs
443 * in flight. However, it also means that the client has to handle recovery
444 * on bulk RPCs, and will have to keep more dirty pages in cache before they
445 * are committed on the OST.
447 * \param[in] m seq_file handle
448 * \param[in] data unused for single entry
450 * \retval 0 on success
451 * \retval negative value on error
453 static int ofd_syncjournal_seq_show(struct seq_file *m, void *data)
455 struct obd_device *obd = m->private;
456 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
458 return seq_printf(m, "%u\n", ofd->ofd_syncjournal);
462 * Set journal mode to synchronous or asynchronous.
464 * \param[in] file proc file
465 * \param[in] buffer string which represents mode
466 * 1: synchronous mode
467 * 0: asynchronous mode
468 * \param[in] count \a buffer length
469 * \param[in] off unused for single entry
471 * \retval \a count on success
472 * \retval negative number on error
475 ofd_syncjournal_seq_write(struct file *file, const char __user *buffer,
476 size_t count, loff_t *off)
478 struct seq_file *m = file->private_data;
479 struct obd_device *obd = m->private;
480 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
484 rc = lprocfs_write_helper(buffer, count, &val);
491 spin_lock(&ofd->ofd_flags_lock);
492 ofd->ofd_syncjournal = !!val;
494 spin_unlock(&ofd->ofd_flags_lock);
498 LPROC_SEQ_FOPS(ofd_syncjournal);
500 /* This must be longer than the longest string below */
501 #define SYNC_STATES_MAXLEN 16
502 static char *sync_on_cancel_states[] = {"never",
507 * Show OFD policy for handling dirty data under a lock being cancelled.
509 * \param[in] m seq_file handle
510 * \param[in] data unused for single entry
512 * \retval 0 on success
513 * \retval negative value on error
515 static int ofd_sync_lock_cancel_seq_show(struct seq_file *m, void *data)
517 struct obd_device *obd = m->private;
518 struct lu_target *tgt = obd->u.obt.obt_lut;
520 return seq_printf(m, "%s\n",
521 sync_on_cancel_states[tgt->lut_sync_lock_cancel]);
525 * Change OFD policy for handling dirty data under a lock being cancelled.
527 * This variable defines what action OFD takes upon lock cancel
528 * There are three possible modes:
529 * 1) never - never do sync upon lock cancel. This can lead to data
530 * inconsistencies if both the OST and client crash while writing a file
531 * that is also concurrently being read by another client. In these cases,
532 * this may allow the file data to "rewind" to an earlier state.
533 * 2) blocking - do sync only if there is blocking lock, e.g. if another
534 * client is trying to access this same object
535 * 3) always - do sync always
537 * \param[in] file proc file
538 * \param[in] buffer string which represents policy
539 * \param[in] count \a buffer length
540 * \param[in] off unused for single entry
542 * \retval \a count on success
543 * \retval negative number on error
546 ofd_sync_lock_cancel_seq_write(struct file *file, const char __user *buffer,
547 size_t count, loff_t *off)
549 struct seq_file *m = file->private_data;
550 struct obd_device *obd = m->private;
551 struct lu_target *tgt = obd->u.obt.obt_lut;
552 char kernbuf[SYNC_STATES_MAXLEN];
556 if (count == 0 || count >= sizeof(kernbuf))
559 if (copy_from_user(kernbuf, buffer, count))
563 if (kernbuf[count - 1] == '\n')
564 kernbuf[count - 1] = 0;
566 for (i = 0 ; i < NUM_SYNC_ON_CANCEL_STATES; i++) {
567 if (strcmp(kernbuf, sync_on_cancel_states[i]) == 0) {
573 /* Legacy numeric codes */
577 /* Safe to use userspace buffer as lprocfs_write_helper will
578 * use copy from user for parsing */
579 rc = lprocfs_write_helper(buffer, count, &val);
584 if (val < 0 || val > 2)
587 spin_lock(&tgt->lut_flags_lock);
588 tgt->lut_sync_lock_cancel = val;
589 spin_unlock(&tgt->lut_flags_lock);
592 LPROC_SEQ_FOPS(ofd_sync_lock_cancel);
595 * Show if grants compatibility mode is disabled.
597 * When ofd_grant_compat_disable is set, we don't grant any space to clients
598 * not supporting OBD_CONNECT_GRANT_PARAM. Otherwise, space granted to such
599 * a client is inflated since it consumes PAGE_CACHE_SIZE of grant space per
600 * block, (i.e. typically 4kB units), but underlaying file system might have
601 * block size bigger than page size, e.g. ZFS. See LU-2049 for details.
603 * \param[in] m seq_file handle
604 * \param[in] data unused for single entry
606 * \retval 0 on success
607 * \retval negative value on error
609 static int ofd_grant_compat_disable_seq_show(struct seq_file *m, void *data)
611 struct obd_device *obd = m->private;
612 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
614 return seq_printf(m, "%u\n", ofd->ofd_grant_compat_disable);
618 * Change grant compatibility mode.
620 * Setting ofd_grant_compat_disable prohibit any space granting to clients
621 * not supporting OBD_CONNECT_GRANT_PARAM. See details above.
623 * \param[in] file proc file
624 * \param[in] buffer string which represents mode
625 * 1: disable compatibility mode
626 * 0: enable compatibility mode
627 * \param[in] count \a buffer length
628 * \param[in] off unused for single entry
630 * \retval \a count on success
631 * \retval negative number on error
634 ofd_grant_compat_disable_seq_write(struct file *file,
635 const char __user *buffer,
636 size_t count, loff_t *off)
638 struct seq_file *m = file->private_data;
639 struct obd_device *obd = m->private;
640 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
644 rc = lprocfs_write_helper(buffer, count, &val);
651 spin_lock(&ofd->ofd_flags_lock);
652 ofd->ofd_grant_compat_disable = !!val;
653 spin_unlock(&ofd->ofd_flags_lock);
657 LPROC_SEQ_FOPS(ofd_grant_compat_disable);
660 * Show the limit of soft sync RPCs.
662 * This value defines how many IO RPCs with OBD_BRW_SOFT_SYNC flag
663 * are allowed before sync update will be triggered.
665 * \param[in] m seq_file handle
666 * \param[in] data unused for single entry
668 * \retval 0 on success
669 * \retval negative value on error
671 static int ofd_soft_sync_limit_seq_show(struct seq_file *m, void *data)
673 struct obd_device *obd = m->private;
674 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
676 return lprocfs_uint_seq_show(m, &ofd->ofd_soft_sync_limit);
680 * Change the limit of soft sync RPCs.
682 * Define how many IO RPCs with OBD_BRW_SOFT_SYNC flag
683 * allowed before sync update will be done.
685 * This limit is global across all exports.
687 * \param[in] file proc file
688 * \param[in] buffer string which represents limit
689 * \param[in] count \a buffer length
690 * \param[in] off unused for single entry
692 * \retval \a count on success
693 * \retval negative number on error
696 ofd_soft_sync_limit_seq_write(struct file *file, const char __user *buffer,
697 size_t count, loff_t *off)
699 struct seq_file *m = file->private_data;
700 struct obd_device *obd = m->private;
701 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
703 return lprocfs_uint_seq_write(file, buffer, count,
704 (loff_t *) &ofd->ofd_soft_sync_limit);
706 LPROC_SEQ_FOPS(ofd_soft_sync_limit);
709 * Show the LFSCK speed limit.
711 * The maximum number of items scanned per second.
713 * \param[in] m seq_file handle
714 * \param[in] data unused for single entry
716 * \retval 0 on success
717 * \retval negative value on error
719 static int ofd_lfsck_speed_limit_seq_show(struct seq_file *m, void *data)
721 struct obd_device *obd = m->private;
722 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
724 return lfsck_get_speed(m, ofd->ofd_osd);
728 * Change the LFSCK speed limit.
730 * Limit number of items that may be scanned per second.
732 * \param[in] file proc file
733 * \param[in] buffer string which represents limit
734 * \param[in] count \a buffer length
735 * \param[in] off unused for single entry
737 * \retval \a count on success
738 * \retval negative number on error
741 ofd_lfsck_speed_limit_seq_write(struct file *file, const char __user *buffer,
742 size_t count, loff_t *off)
744 struct seq_file *m = file->private_data;
745 struct obd_device *obd = m->private;
746 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
750 rc = lprocfs_write_helper(buffer, count, &val);
754 rc = lfsck_set_speed(ofd->ofd_osd, val);
756 return rc != 0 ? rc : count;
758 LPROC_SEQ_FOPS(ofd_lfsck_speed_limit);
761 * Show LFSCK layout verification stats from the most recent LFSCK run.
763 * \param[in] m seq_file handle
764 * \param[in] data unused for single entry
766 * \retval 0 on success
767 * \retval negative value on error
769 static int ofd_lfsck_layout_seq_show(struct seq_file *m, void *data)
771 struct obd_device *obd = m->private;
772 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
774 return lfsck_dump(m, ofd->ofd_osd, LFSCK_TYPE_LAYOUT);
776 LPROC_SEQ_FOPS_RO(ofd_lfsck_layout);
779 * Show if LFSCK performed parent FID verification.
781 * \param[in] m seq_file handle
782 * \param[in] data unused for single entry
784 * \retval 0 on success
785 * \retval negative value on error
787 static int ofd_lfsck_verify_pfid_seq_show(struct seq_file *m, void *data)
789 struct obd_device *obd = m->private;
790 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
793 "switch: %s\ndetected: "LPU64"\nrepaired: "LPU64"\n",
794 ofd->ofd_lfsck_verify_pfid ? "on" : "off",
795 ofd->ofd_inconsistency_self_detected,
796 ofd->ofd_inconsistency_self_repaired);
800 * Set the LFSCK behavior to verify parent FID correctness.
802 * If flag ofd_lfsck_verify_pfid is set then LFSCK does parent FID
803 * verification during read/write operations.
805 * \param[in] file proc file
806 * \param[in] buffer string which represents behavior
807 * 1: verify parent FID
808 * 0: don't verify parent FID
809 * \param[in] count \a buffer length
810 * \param[in] off unused for single entry
812 * \retval \a count on success
813 * \retval negative number on error
816 ofd_lfsck_verify_pfid_seq_write(struct file *file, const char __user *buffer,
817 size_t count, loff_t *off)
819 struct seq_file *m = file->private_data;
820 struct obd_device *obd = m->private;
821 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
825 rc = lprocfs_write_helper(buffer, count, &val);
829 ofd->ofd_lfsck_verify_pfid = !!val;
833 LPROC_SEQ_FOPS(ofd_lfsck_verify_pfid);
835 LPROC_SEQ_FOPS_RO_TYPE(ofd, uuid);
836 LPROC_SEQ_FOPS_RO_TYPE(ofd, blksize);
837 LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytestotal);
838 LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesfree);
839 LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesavail);
840 LPROC_SEQ_FOPS_RO_TYPE(ofd, filestotal);
841 LPROC_SEQ_FOPS_RO_TYPE(ofd, filesfree);
843 LPROC_SEQ_FOPS_RO_TYPE(ofd, recovery_status);
844 LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_soft);
845 LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_hard);
846 LPROC_SEQ_FOPS_WO_TYPE(ofd, evict_client);
847 LPROC_SEQ_FOPS_RO_TYPE(ofd, num_exports);
848 LPROC_SEQ_FOPS_RO_TYPE(ofd, target_instance);
849 LPROC_SEQ_FOPS_RW_TYPE(ofd, ir_factor);
850 LPROC_SEQ_FOPS_RW_TYPE(ofd, job_interval);
852 struct lprocfs_vars lprocfs_ofd_obd_vars[] = {
854 .fops = &ofd_uuid_fops },
855 { .name = "blocksize",
856 .fops = &ofd_blksize_fops },
857 { .name = "kbytestotal",
858 .fops = &ofd_kbytestotal_fops },
859 { .name = "kbytesfree",
860 .fops = &ofd_kbytesfree_fops },
861 { .name = "kbytesavail",
862 .fops = &ofd_kbytesavail_fops },
863 { .name = "filestotal",
864 .fops = &ofd_filestotal_fops },
865 { .name = "filesfree",
866 .fops = &ofd_filesfree_fops },
867 { .name = "seqs_allocated",
868 .fops = &ofd_seqs_fops },
870 .fops = &ofd_fstype_fops },
872 .fops = &ofd_last_id_fops },
873 { .name = "tot_dirty",
874 .fops = &ofd_tot_dirty_fops },
875 { .name = "tot_pending",
876 .fops = &ofd_tot_pending_fops },
877 { .name = "tot_granted",
878 .fops = &ofd_tot_granted_fops },
879 { .name = "grant_precreate",
880 .fops = &ofd_grant_precreate_fops },
881 { .name = "precreate_batch",
882 .fops = &ofd_precreate_batch_fops },
883 { .name = "recovery_status",
884 .fops = &ofd_recovery_status_fops },
885 { .name = "recovery_time_soft",
886 .fops = &ofd_recovery_time_soft_fops },
887 { .name = "recovery_time_hard",
888 .fops = &ofd_recovery_time_hard_fops },
889 { .name = "evict_client",
890 .fops = &ofd_evict_client_fops },
891 { .name = "num_exports",
892 .fops = &ofd_num_exports_fops },
893 { .name = "degraded",
894 .fops = &ofd_degraded_fops },
895 { .name = "sync_journal",
896 .fops = &ofd_syncjournal_fops },
897 { .name = "sync_on_lock_cancel",
898 .fops = &ofd_sync_lock_cancel_fops },
899 { .name = "instance",
900 .fops = &ofd_target_instance_fops },
901 { .name = "ir_factor",
902 .fops = &ofd_ir_factor_fops },
903 { .name = "grant_compat_disable",
904 .fops = &ofd_grant_compat_disable_fops },
905 { .name = "client_cache_count",
906 .fops = &ofd_fmd_max_num_fops },
907 { .name = "client_cache_seconds",
908 .fops = &ofd_fmd_max_age_fops },
909 { .name = "job_cleanup_interval",
910 .fops = &ofd_job_interval_fops },
911 { .name = "soft_sync_limit",
912 .fops = &ofd_soft_sync_limit_fops },
913 { .name = "lfsck_speed_limit",
914 .fops = &ofd_lfsck_speed_limit_fops },
915 { .name = "lfsck_layout",
916 .fops = &ofd_lfsck_layout_fops },
917 { .name = "lfsck_verify_pfid",
918 .fops = &ofd_lfsck_verify_pfid_fops },
923 * Initialize OFD statistics counters
925 * param[in] stats statistics counters
927 void ofd_stats_counter_init(struct lprocfs_stats *stats)
929 LASSERT(stats && stats->ls_num >= LPROC_OFD_STATS_LAST);
931 lprocfs_counter_init(stats, LPROC_OFD_STATS_READ,
932 LPROCFS_CNTR_AVGMINMAX, "read_bytes", "bytes");
933 lprocfs_counter_init(stats, LPROC_OFD_STATS_WRITE,
934 LPROCFS_CNTR_AVGMINMAX, "write_bytes", "bytes");
935 lprocfs_counter_init(stats, LPROC_OFD_STATS_GETATTR,
936 0, "getattr", "reqs");
937 lprocfs_counter_init(stats, LPROC_OFD_STATS_SETATTR,
938 0, "setattr", "reqs");
939 lprocfs_counter_init(stats, LPROC_OFD_STATS_PUNCH,
941 lprocfs_counter_init(stats, LPROC_OFD_STATS_SYNC,
943 lprocfs_counter_init(stats, LPROC_OFD_STATS_DESTROY,
944 0, "destroy", "reqs");
945 lprocfs_counter_init(stats, LPROC_OFD_STATS_CREATE,
946 0, "create", "reqs");
947 lprocfs_counter_init(stats, LPROC_OFD_STATS_STATFS,
948 0, "statfs", "reqs");
949 lprocfs_counter_init(stats, LPROC_OFD_STATS_GET_INFO,
950 0, "get_info", "reqs");
951 lprocfs_counter_init(stats, LPROC_OFD_STATS_SET_INFO,
952 0, "set_info", "reqs");
953 lprocfs_counter_init(stats, LPROC_OFD_STATS_QUOTACTL,
954 0, "quotactl", "reqs");
957 #endif /* CONFIG_PROC_FS */