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) 2007, 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/osp/lproc_osp.c
34 * Lustre OST Proxy Device (OSP), procfs functions
36 * Author: Alex Zhuravlev <alexey.zhuravlev@intel.com>
39 #define DEBUG_SUBSYSTEM S_CLASS
41 #include "osp_internal.h"
45 * Show OSP active status
47 * \param[in] m seq_file handle
48 * \param[in] data unused for single entry
49 * \retval 0 on success
50 * \retval negative number on error
52 static int osp_active_seq_show(struct seq_file *m, void *data)
54 struct obd_device *dev = m->private;
56 LPROCFS_CLIMP_CHECK(dev);
57 seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
58 LPROCFS_CLIMP_EXIT(dev);
63 * Activate/Deactivate OSP
65 * \param[in] file proc file
66 * \param[in] buffer string, which is "1" or "0" to activate/deactivate OSP
67 * \param[in] count \a buffer length
68 * \param[in] off unused for single entry
69 * \retval \a count on success
70 * \retval negative number on error
73 osp_active_seq_write(struct file *file, const char __user *buffer,
74 size_t count, loff_t *off)
76 struct seq_file *m = file->private_data;
77 struct obd_device *dev = m->private;
81 rc = kstrtobool_from_user(buffer, count, &val);
85 LPROCFS_CLIMP_CHECK(dev);
87 if (dev->u.cli.cl_import->imp_deactive == val)
88 rc = ptlrpc_set_import_active(dev->u.cli.cl_import, val);
90 CDEBUG(D_CONFIG, "activate %d: ignoring repeat request\n",
93 LPROCFS_CLIMP_EXIT(dev);
96 LPROC_SEQ_FOPS(osp_active);
99 * Show number of RPCs in flight
101 * \param[in] m seq_file handle
102 * \param[in] data unused for single entry
103 * \retval 0 on success
104 * \retval negative number on error
106 static int osp_sync_rpcs_in_flight_seq_show(struct seq_file *m, void *data)
108 struct obd_device *dev = m->private;
109 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
114 seq_printf(m, "%u\n", atomic_read(&osp->opd_sync_rpcs_in_flight));
117 LPROC_SEQ_FOPS_RO(osp_sync_rpcs_in_flight);
120 * Show number of RPCs in processing (including uncommitted by OST)
122 * \param[in] m seq_file handle
123 * \param[in] data unused for single entry
124 * \retval 0 on success
125 * \retval negative number on error
127 static int osp_sync_rpcs_in_progress_seq_show(struct seq_file *m, void *data)
129 struct obd_device *dev = m->private;
130 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
135 seq_printf(m, "%u\n", atomic_read(&osp->opd_sync_rpcs_in_progress));
138 LPROC_SEQ_FOPS_RO(osp_sync_rpcs_in_progress);
141 * Show number of changes to sync
143 * \param[in] m seq_file handle
144 * \param[in] data unused for single entry
145 * \retval 0 on success
146 * \retval negative number on error
148 static int osp_sync_changes_seq_show(struct seq_file *m, void *data)
150 struct obd_device *dev = m->private;
151 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
156 seq_printf(m, "%u\n", atomic_read(&osp->opd_sync_changes));
163 * \param[in] file proc file
164 * \param[in] buffer unused because any input will do
165 * \param[in] count \a buffer length
166 * \param[in] off unused for single entry
167 * \retval \a count on success
168 * \retval negative number on error
170 static ssize_t osp_sync_changes_seq_write(struct file *file,
171 const char __user *buffer,
172 size_t count, loff_t *off)
174 struct seq_file *m = file->private_data;
175 struct obd_device *dev = m->private;
176 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
180 rc = lu_env_init(&env, LCT_LOCAL);
184 rc = dt_sync(&env, &osp->opd_dt_dev);
187 return rc == 0 ? count : rc;
189 LPROC_SEQ_FOPS(osp_sync_changes);
192 * Show maximum number of RPCs in flight allowed
194 * \param[in] m seq_file handle
195 * \param[in] data unused for single entry
196 * \retval 0 on success
197 * \retval negative number on error
199 static int osp_max_rpcs_in_flight_seq_show(struct seq_file *m, void *data)
201 struct obd_device *dev = m->private;
202 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
207 seq_printf(m, "%u\n", osp->opd_sync_max_rpcs_in_flight);
212 * Change maximum number of RPCs in flight allowed
214 * \param[in] file proc file
215 * \param[in] buffer string which represents maximum number
216 * \param[in] count \a buffer length
217 * \param[in] off unused for single entry
218 * \retval \a count on success
219 * \retval negative number on error
222 osp_max_rpcs_in_flight_seq_write(struct file *file, const char __user *buffer,
223 size_t count, loff_t *off)
225 struct seq_file *m = file->private_data;
226 struct obd_device *dev = m->private;
227 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
234 rc = kstrtouint_from_user(buffer, count, 0, &val);
241 osp->opd_sync_max_rpcs_in_flight = val;
244 LPROC_SEQ_FOPS(osp_max_rpcs_in_flight);
247 * Show maximum number of RPCs in processing allowed
249 * \param[in] m seq_file handle
250 * \param[in] data unused
251 * \retval 0 on success
252 * \retval negative number on error
254 static int osp_max_rpcs_in_progress_seq_show(struct seq_file *m, void *data)
256 struct obd_device *dev = m->private;
257 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
262 seq_printf(m, "%u\n", osp->opd_sync_max_rpcs_in_progress);
267 * Change maximum number of RPCs in processing allowed
269 * \param[in] file proc file
270 * \param[in] buffer string which represents maximum number
271 * \param[in] count \a buffer length
272 * \param[in] off unused for single entry
273 * \retval \a count on success
274 * \retval negative number on error
277 osp_max_rpcs_in_progress_seq_write(struct file *file, const char __user *buffer,
278 size_t count, loff_t *off)
280 struct seq_file *m = file->private_data;
281 struct obd_device *dev = m->private;
282 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
289 rc = kstrtouint_from_user(buffer, count, 0, &val);
296 osp->opd_sync_max_rpcs_in_progress = val;
300 LPROC_SEQ_FOPS(osp_max_rpcs_in_progress);
303 * Show number of objects to precreate next time
305 * \param[in] m seq_file handle
306 * \param[in] data unused for single entry
307 * \retval 0 on success
308 * \retval negative number on error
310 static int osp_create_count_seq_show(struct seq_file *m, void *data)
312 struct obd_device *obd = m->private;
313 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
315 if (osp == NULL || osp->opd_pre == NULL)
318 seq_printf(m, "%d\n", osp->opd_pre_create_count);
323 * Change number of objects to precreate next time
325 * \param[in] file proc file
326 * \param[in] buffer string which represents number of objects to precreate
327 * \param[in] count \a buffer length
328 * \param[in] off unused for single entry
329 * \retval \a count on success
330 * \retval negative number on error
333 osp_create_count_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 osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
342 if (osp == NULL || osp->opd_pre == NULL)
345 rc = kstrtouint_from_user(buffer, count, 0, &val);
349 /* The MDT ALWAYS needs to limit the precreate count to
350 * OST_MAX_PRECREATE, and the constant cannot be changed
351 * because it is a value shared between the OSP and OST
352 * that is the maximum possible number of objects that will
353 * ever be handled by MDT->OST recovery processing.
355 * If the OST ever gets a request to delete more orphans,
356 * this implies that something has gone badly on the MDT
357 * and the OST will refuse to delete so much data from the
358 * filesystem as a safety measure. */
359 if (val < OST_MIN_PRECREATE || val > OST_MAX_PRECREATE)
361 if (val > osp->opd_pre_max_create_count)
364 for (i = 1; (i << 1) <= val; i <<= 1)
366 osp->opd_pre_create_count = i;
370 LPROC_SEQ_FOPS(osp_create_count);
373 * Show maximum number of objects to precreate
375 * \param[in] m seq_file handle
376 * \param[in] data unused for single entry
377 * \retval 0 on success
378 * \retval negative number on error
380 static int osp_max_create_count_seq_show(struct seq_file *m, void *data)
382 struct obd_device *obd = m->private;
383 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
385 if (osp == NULL || osp->opd_pre == NULL)
388 seq_printf(m, "%d\n", osp->opd_pre_max_create_count);
393 * Change maximum number of objects to precreate
395 * \param[in] file proc file
396 * \param[in] buffer string which represents maximum number
397 * \param[in] count \a buffer length
398 * \param[in] off unused for single entry
399 * \retval \a count on success
400 * \retval negative number on error
403 osp_max_create_count_seq_write(struct file *file, const char __user *buffer,
404 size_t count, loff_t *off)
406 struct seq_file *m = file->private_data;
407 struct obd_device *obd = m->private;
408 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
412 if (osp == NULL || osp->opd_pre == NULL)
415 rc = kstrtouint_from_user(buffer, count, 0, &val);
419 if (val < 0 || val > INT_MAX)
421 if (val > OST_MAX_PRECREATE)
424 if (osp->opd_pre_create_count > val)
425 osp->opd_pre_create_count = val;
427 osp->opd_pre_max_create_count = val;
431 LPROC_SEQ_FOPS(osp_max_create_count);
434 * Show last id to assign in creation
436 * \param[in] m seq_file handle
437 * \param[in] data unused for single entry
438 * \retval 0 on success
439 * \retval negative number on error
441 static int osp_prealloc_next_id_seq_show(struct seq_file *m, void *data)
443 struct obd_device *obd = m->private;
444 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
448 if (osp == NULL || osp->opd_pre == NULL)
451 fid = &osp->opd_pre_used_fid;
452 if (fid_is_idif(fid)) {
453 id = fid_idif_id(fid_seq(fid), fid_oid(fid), fid_ver(fid));
456 id = unlikely(fid_oid(fid) == LUSTRE_DATA_SEQ_MAX_WIDTH) ?
457 1 : fid_oid(fid) + 1;
460 seq_printf(m, "%llu\n", id);
463 LPROC_SEQ_FOPS_RO(osp_prealloc_next_id);
466 * Show last created id OST reported
468 * \param[in] m seq_file handle
469 * \param[in] data unused for single entry
470 * \retval 0 on success
471 * \retval negative number on error
473 static int osp_prealloc_last_id_seq_show(struct seq_file *m, void *data)
475 struct obd_device *obd = m->private;
476 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
480 if (osp == NULL || osp->opd_pre == NULL)
482 fid = &osp->opd_pre_last_created_fid;
483 id = fid_is_idif(fid) ?
484 fid_idif_id(fid_seq(fid), fid_oid(fid), fid_ver(fid)) :
487 seq_printf(m, "%llu\n", id);
490 LPROC_SEQ_FOPS_RO(osp_prealloc_last_id);
493 * Show next FID sequence to precreate
495 * \param[in] m seq_file handle
496 * \param[in] data unused for single entry
497 * \retval 0 on success
498 * \retval negative number on error
500 static int osp_prealloc_next_seq_seq_show(struct seq_file *m, void *data)
502 struct obd_device *obd = m->private;
503 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
506 if (osp == NULL || osp->opd_pre == NULL)
509 fid = &osp->opd_pre_used_fid;
510 seq_printf(m, "%#llx\n", fid_is_idif(fid) ?
511 fid_seq(fid) & (~0xffff) : fid_seq(fid));
515 LPROC_SEQ_FOPS_RO(osp_prealloc_next_seq);
518 * Show last created FID sequence OST reported
520 * \param[in] m seq_file handle
521 * \param[in] data unused for single entry
522 * \retval 0 on success
523 * \retval negative number on error
525 static int osp_prealloc_last_seq_seq_show(struct seq_file *m, void *data)
527 struct obd_device *obd = m->private;
528 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
531 if (osp == NULL || osp->opd_pre == NULL)
534 fid = &osp->opd_pre_last_created_fid;
535 seq_printf(m, "%#llx\n", fid_is_idif(fid) ?
536 fid_seq(fid) & (~0xffff) : fid_seq(fid));
540 LPROC_SEQ_FOPS_RO(osp_prealloc_last_seq);
543 * Show the number of ids reserved by declare
545 * \param[in] m seq_file handle
546 * \param[in] data unused for single entry
547 * \retval 0 on success
548 * \retval negative number on error
550 static int osp_prealloc_reserved_seq_show(struct seq_file *m, void *data)
552 struct obd_device *obd = m->private;
553 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
555 if (osp == NULL || osp->opd_pre == NULL)
558 seq_printf(m, "%llu\n", osp->opd_pre_reserved);
561 LPROC_SEQ_FOPS_RO(osp_prealloc_reserved);
564 * Show interval (in seconds) to update statfs data
566 * \param[in] m seq_file handle
567 * \param[in] data unused for single entry
568 * \retval 0 on success
569 * \retval negative number on error
571 static int osp_maxage_seq_show(struct seq_file *m, void *data)
573 struct obd_device *dev = m->private;
574 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
579 seq_printf(m, "%lld\n", osp->opd_statfs_maxage);
584 * Change interval to update statfs data
586 * \param[in] file proc file
587 * \param[in] buffer string which represents statfs interval (in seconds)
588 * \param[in] count \a buffer length
589 * \param[in] off unused for single entry
590 * \retval \a count on success
591 * \retval negative number on error
594 osp_maxage_seq_write(struct file *file, const char __user *buffer,
595 size_t count, loff_t *off)
597 struct seq_file *m = file->private_data;
598 struct obd_device *dev = m->private;
599 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
606 rc = kstrtouint_from_user(buffer, count, 0, &val);
613 osp->opd_statfs_maxage = val;
617 LPROC_SEQ_FOPS(osp_maxage);
620 * Show current precreation status: output 0 means success, otherwise negative
623 * \param[in] m seq_file handle
624 * \param[in] data unused for single entry
625 * \retval 0 on success
626 * \retval negative number on error
628 static int osp_pre_status_seq_show(struct seq_file *m, void *data)
630 struct obd_device *dev = m->private;
631 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
633 if (osp == NULL || osp->opd_pre == NULL)
636 seq_printf(m, "%d\n", osp->opd_pre_status);
639 LPROC_SEQ_FOPS_RO(osp_pre_status);
642 * Show the number of RPCs in processing (including uncommitted by OST) plus
643 * changes to sync, i.e. this is the total number of changes OST needs to apply
646 * This counter is used to determine if OST has space returned. A zero value
647 * indicates that OST storage space consumed by destroyed objects has been freed
648 * on disk, the associated llog records have been cleared, and no synchronous
649 * RPC are being processed.
651 * \param[in] m seq_file handle
652 * \param[in] data unused for single entry
653 * \retval 0 on success
654 * \retval negative number on error
656 static int osp_destroys_in_flight_seq_show(struct seq_file *m, void *data)
658 struct obd_device *dev = m->private;
659 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
664 seq_printf(m, "%u\n",
665 atomic_read(&osp->opd_sync_rpcs_in_progress) +
666 atomic_read(&osp->opd_sync_changes));
669 LPROC_SEQ_FOPS_RO(osp_destroys_in_flight);
672 * Show changes synced from previous mount
674 * \param[in] m seq_file handle
675 * \param[in] data unused for single entry
676 * \retval 0 on success
677 * \retval negative number on error
679 static int osp_old_sync_processed_seq_show(struct seq_file *m, void *data)
681 struct obd_device *dev = m->private;
682 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
687 seq_printf(m, "%d\n", osp->opd_sync_prev_done);
690 LPROC_SEQ_FOPS_RO(osp_old_sync_processed);
693 * Show maximum number of RPCs in flight
695 * \param[in] m seq_file handle
696 * \param[in] data unused for single entry
697 * \retval 0 on success
698 * \retval negative number on error
701 osp_lfsck_max_rpcs_in_flight_seq_show(struct seq_file *m, void *data)
703 struct obd_device *dev = m->private;
706 max = obd_get_max_rpcs_in_flight(&dev->u.cli);
707 seq_printf(m, "%u\n", max);
712 * Change maximum number of RPCs in flight
714 * \param[in] file proc file
715 * \param[in] buffer string which represents maximum number of RPCs in flight
716 * \param[in] count \a buffer length
717 * \param[in] off unused for single entry
718 * \retval \a count on success
719 * \retval negative number on error
722 osp_lfsck_max_rpcs_in_flight_seq_write(struct file *file,
723 const char __user *buffer,
724 size_t count, loff_t *off)
726 struct seq_file *m = file->private_data;
727 struct obd_device *dev = m->private;
731 rc = kstrtouint_from_user(buffer, count, 0, &val);
733 rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val);
739 LPROC_SEQ_FOPS(osp_lfsck_max_rpcs_in_flight);
741 LPROC_SEQ_FOPS_WR_ONLY(osp, ping);
742 LPROC_SEQ_FOPS_RO_TYPE(osp, connect_flags);
743 LPROC_SEQ_FOPS_RO_TYPE(osp, server_uuid);
744 LPROC_SEQ_FOPS_RO_TYPE(osp, conn_uuid);
746 LPROC_SEQ_FOPS_RO_TYPE(osp, timeouts);
748 LPROC_SEQ_FOPS_RW_TYPE(osp, import);
749 LPROC_SEQ_FOPS_RO_TYPE(osp, state);
752 * Show high watermark (in megabytes). If available free space at OST is grater
753 * than high watermark and object allocation for OST is disabled, enable it.
755 * \param[in] m seq_file handle
756 * \param[in] data unused for single entry
757 * \retval 0 on success
758 * \retval negative number on error
760 static int osp_reserved_mb_high_seq_show(struct seq_file *m, void *data)
762 struct obd_device *dev = m->private;
763 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
768 seq_printf(m, "%u\n", osp->opd_reserved_mb_high);
773 * Change high watermark
775 * \param[in] file proc file
776 * \param[in] buffer string which represents new value (in megabytes)
777 * \param[in] count \a buffer length
778 * \param[in] off unused for single entry
779 * \retval \a count on success
780 * \retval negative number on error
783 osp_reserved_mb_high_seq_write(struct file *file, const char __user *buffer,
784 size_t count, loff_t *off)
786 struct seq_file *m = file->private_data;
787 struct obd_device *dev = m->private;
788 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
795 rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
802 spin_lock(&osp->opd_pre_lock);
803 osp->opd_reserved_mb_high = val;
804 if (val <= osp->opd_reserved_mb_low)
805 osp->opd_reserved_mb_low = val - 1;
806 spin_unlock(&osp->opd_pre_lock);
810 LPROC_SEQ_FOPS(osp_reserved_mb_high);
813 * Show low watermark (in megabytes). If available free space at OST is less
814 * than low watermark, object allocation for OST is disabled.
816 * \param[in] m seq_file handle
817 * \param[in] data unused for single entry
818 * \retval 0 on success
819 * \retval negative number on error
821 static int osp_reserved_mb_low_seq_show(struct seq_file *m, void *data)
823 struct obd_device *dev = m->private;
824 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
829 seq_printf(m, "%u\n", osp->opd_reserved_mb_low);
834 * Change low watermark
836 * \param[in] file proc file
837 * \param[in] buffer string which represents new value (in megabytes)
838 * \param[in] count \a buffer length
839 * \param[in] off unused for single entry
840 * \retval \a count on success
841 * \retval negative number on error
844 osp_reserved_mb_low_seq_write(struct file *file, const char __user *buffer,
845 size_t count, loff_t *off)
847 struct seq_file *m = file->private_data;
848 struct obd_device *dev = m->private;
849 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
856 rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
861 spin_lock(&osp->opd_pre_lock);
862 osp->opd_reserved_mb_low = val;
863 if (val >= osp->opd_reserved_mb_high)
864 osp->opd_reserved_mb_high = val + 1;
865 spin_unlock(&osp->opd_pre_lock);
869 LPROC_SEQ_FOPS(osp_reserved_mb_low);
872 lprocfs_force_sync_seq_write(struct file *file, const char __user *buffer,
873 size_t count, loff_t *off)
875 struct seq_file *m = file->private_data;
876 struct obd_device *dev = m->private;
877 struct dt_device *dt = lu2dt_dev(dev->obd_lu_dev);
881 rc = lu_env_init(&env, LCT_LOCAL);
884 rc = dt_sync(&env, dt);
887 return rc == 0 ? count : rc;
889 LPROC_SEQ_FOPS_WR_ONLY(osp, force_sync);
891 static struct lprocfs_vars lprocfs_osp_obd_vars[] = {
893 .fops = &osp_ping_fops,
895 { .name = "connect_flags",
896 .fops = &osp_connect_flags_fops },
897 { .name = "ost_server_uuid",
898 .fops = &osp_server_uuid_fops },
899 { .name = "ost_conn_uuid",
900 .fops = &osp_conn_uuid_fops },
902 .fops = &osp_active_fops },
903 { .name = "max_rpcs_in_flight",
904 .fops = &osp_max_rpcs_in_flight_fops },
905 { .name = "max_rpcs_in_progress",
906 .fops = &osp_max_rpcs_in_progress_fops },
907 { .name = "create_count",
908 .fops = &osp_create_count_fops },
909 { .name = "max_create_count",
910 .fops = &osp_max_create_count_fops },
911 { .name = "prealloc_next_id",
912 .fops = &osp_prealloc_next_id_fops },
913 { .name = "prealloc_next_seq",
914 .fops = &osp_prealloc_next_seq_fops },
915 { .name = "prealloc_last_id",
916 .fops = &osp_prealloc_last_id_fops },
917 { .name = "prealloc_last_seq",
918 .fops = &osp_prealloc_last_seq_fops },
919 { .name = "prealloc_reserved",
920 .fops = &osp_prealloc_reserved_fops },
921 { .name = "timeouts",
922 .fops = &osp_timeouts_fops },
924 .fops = &osp_import_fops },
926 .fops = &osp_state_fops },
928 .fops = &osp_maxage_fops },
929 { .name = "prealloc_status",
930 .fops = &osp_pre_status_fops },
931 { .name = "sync_changes",
932 .fops = &osp_sync_changes_fops },
933 { .name = "sync_in_flight",
934 .fops = &osp_sync_rpcs_in_flight_fops },
935 { .name = "sync_in_progress",
936 .fops = &osp_sync_rpcs_in_progress_fops },
937 { .name = "old_sync_processed",
938 .fops = &osp_old_sync_processed_fops },
939 { .name = "reserved_mb_high",
940 .fops = &osp_reserved_mb_high_fops },
941 { .name = "reserved_mb_low",
942 .fops = &osp_reserved_mb_low_fops },
943 { .name = "force_sync",
944 .fops = &osp_force_sync_fops },
946 /* for compatibility reasons */
947 { .name = "destroys_in_flight",
948 .fops = &osp_destroys_in_flight_fops },
949 { .name = "lfsck_max_rpcs_in_flight",
950 .fops = &osp_lfsck_max_rpcs_in_flight_fops },
954 static struct lprocfs_vars lprocfs_osp_md_vars[] = {
956 .fops = &osp_ping_fops,
958 { .name = "connect_flags",
959 .fops = &osp_connect_flags_fops },
960 { .name = "mdt_server_uuid",
961 .fops = &osp_server_uuid_fops },
962 { .name = "mdt_conn_uuid",
963 .fops = &osp_conn_uuid_fops },
965 .fops = &osp_active_fops },
966 { .name = "max_rpcs_in_flight",
967 .fops = &osp_max_rpcs_in_flight_fops },
968 { .name = "max_rpcs_in_progress",
969 .fops = &osp_max_rpcs_in_progress_fops },
970 { .name = "timeouts",
971 .fops = &osp_timeouts_fops },
973 .fops = &osp_import_fops },
975 .fops = &osp_state_fops },
977 .fops = &osp_maxage_fops },
978 { .name = "prealloc_status",
979 .fops = &osp_pre_status_fops },
981 /* for compatibility reasons */
982 { .name = "destroys_in_flight",
983 .fops = &osp_destroys_in_flight_fops },
984 { .name = "lfsck_max_rpcs_in_flight",
985 .fops = &osp_lfsck_max_rpcs_in_flight_fops },
989 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_blksize);
990 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytestotal);
991 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytesfree);
992 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytesavail);
993 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_filestotal);
994 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_filesfree);
996 static struct lprocfs_vars lprocfs_osp_osd_vars[] = {
997 { .name = "blocksize",
998 .fops = &osp_dt_blksize_fops },
999 { .name = "kbytestotal",
1000 .fops = &osp_dt_kbytestotal_fops },
1001 { .name = "kbytesfree",
1002 .fops = &osp_dt_kbytesfree_fops },
1003 { .name = "kbytesavail",
1004 .fops = &osp_dt_kbytesavail_fops },
1005 { .name = "filestotal",
1006 .fops = &osp_dt_filestotal_fops },
1007 { .name = "filesfree",
1008 .fops = &osp_dt_filesfree_fops },
1013 * Initialize OSP lprocfs
1015 * param[in] osp OSP device
1017 void osp_lprocfs_init(struct osp_device *osp)
1019 struct obd_device *obd = osp->opd_obd;
1020 struct proc_dir_entry *osc_proc_dir = NULL;
1021 struct obd_type *type;
1024 if (osp->opd_connect_mdt)
1025 obd->obd_vars = lprocfs_osp_md_vars;
1027 obd->obd_vars = lprocfs_osp_obd_vars;
1028 if (lprocfs_obd_setup(obd, true) != 0)
1031 rc = lprocfs_add_vars(obd->obd_proc_entry, lprocfs_osp_osd_vars,
1034 CERROR("%s: can't register in lprocfs, rc %d\n",
1039 sptlrpc_lprocfs_cliobd_attach(obd);
1040 ptlrpc_lprocfs_register_obd(obd);
1042 if (osp->opd_connect_mdt || !strstr(obd->obd_name, "osc"))
1045 /* If the real OSC is present which is the case for setups
1046 * with both server and clients on the same node then use
1047 * the OSC's proc root */
1048 type = class_search_type(LUSTRE_OSC_NAME);
1049 if (type != NULL && type->typ_procroot != NULL)
1050 osc_proc_dir = type->typ_procroot;
1052 osc_proc_dir = obd->obd_type->typ_procsym;
1054 if (osc_proc_dir == NULL)
1057 /* for compatibility we link old procfs's OSC entries to osp ones */
1058 osp->opd_symlink = lprocfs_add_symlink(obd->obd_name, osc_proc_dir,
1059 "../osp/%s", obd->obd_name);
1060 if (osp->opd_symlink == NULL)
1061 CERROR("cannot create OSC symlink for /proc/fs/lustre/osp/%s\n",
1065 #endif /* CONFIG_PROC_FS */