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, 2016, 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 = lprocfs_str_to_s64(buffer, count, &val);
84 if (val < 0 || val > 1)
87 LPROCFS_CLIMP_CHECK(dev);
89 if (dev->u.cli.cl_import->imp_deactive == val)
90 rc = ptlrpc_set_import_active(dev->u.cli.cl_import, val);
92 CDEBUG(D_CONFIG, "activate %lld: ignoring repeat request\n",
95 LPROCFS_CLIMP_EXIT(dev);
98 LPROC_SEQ_FOPS(osp_active);
101 * Show number of RPCs in flight
103 * \param[in] m seq_file handle
104 * \param[in] data unused for single entry
105 * \retval 0 on success
106 * \retval negative number on error
108 static int osp_sync_rpcs_in_flight_seq_show(struct seq_file *m, void *data)
110 struct obd_device *dev = m->private;
111 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
116 seq_printf(m, "%u\n", atomic_read(&osp->opd_sync_rpcs_in_flight));
119 LPROC_SEQ_FOPS_RO(osp_sync_rpcs_in_flight);
122 * Show number of RPCs in processing (including uncommitted by OST)
124 * \param[in] m seq_file handle
125 * \param[in] data unused for single entry
126 * \retval 0 on success
127 * \retval negative number on error
129 static int osp_sync_rpcs_in_progress_seq_show(struct seq_file *m, void *data)
131 struct obd_device *dev = m->private;
132 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
137 seq_printf(m, "%u\n", atomic_read(&osp->opd_sync_rpcs_in_progress));
140 LPROC_SEQ_FOPS_RO(osp_sync_rpcs_in_progress);
143 * Show number of changes to sync
145 * \param[in] m seq_file handle
146 * \param[in] data unused for single entry
147 * \retval 0 on success
148 * \retval negative number on error
150 static int osp_sync_changes_seq_show(struct seq_file *m, void *data)
152 struct obd_device *dev = m->private;
153 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
158 seq_printf(m, "%u\n", atomic_read(&osp->opd_sync_changes));
165 * \param[in] file proc file
166 * \param[in] buffer unused because any input will do
167 * \param[in] count \a buffer length
168 * \param[in] off unused for single entry
169 * \retval \a count on success
170 * \retval negative number on error
172 static ssize_t osp_sync_changes_seq_write(struct file *file,
173 const char __user *buffer,
174 size_t count, loff_t *off)
176 struct seq_file *m = file->private_data;
177 struct obd_device *dev = m->private;
178 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
182 rc = lu_env_init(&env, LCT_LOCAL);
186 rc = dt_sync(&env, &osp->opd_dt_dev);
189 return rc == 0 ? count : rc;
191 LPROC_SEQ_FOPS(osp_sync_changes);
194 * Show maximum number of RPCs in flight allowed
196 * \param[in] m seq_file handle
197 * \param[in] data unused for single entry
198 * \retval 0 on success
199 * \retval negative number on error
201 static int osp_max_rpcs_in_flight_seq_show(struct seq_file *m, void *data)
203 struct obd_device *dev = m->private;
204 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
209 seq_printf(m, "%u\n", osp->opd_sync_max_rpcs_in_flight);
214 * Change maximum number of RPCs in flight allowed
216 * \param[in] file proc file
217 * \param[in] buffer string which represents maximum number
218 * \param[in] count \a buffer length
219 * \param[in] off unused for single entry
220 * \retval \a count on success
221 * \retval negative number on error
224 osp_max_rpcs_in_flight_seq_write(struct file *file, const char __user *buffer,
225 size_t count, loff_t *off)
227 struct seq_file *m = file->private_data;
228 struct obd_device *dev = m->private;
229 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
236 rc = lprocfs_str_to_s64(buffer, count, &val);
240 if (val < 1 || val > INT_MAX)
243 osp->opd_sync_max_rpcs_in_flight = val;
246 LPROC_SEQ_FOPS(osp_max_rpcs_in_flight);
249 * Show maximum number of RPCs in processing allowed
251 * \param[in] m seq_file handle
252 * \param[in] data unused
253 * \retval 0 on success
254 * \retval negative number on error
256 static int osp_max_rpcs_in_progress_seq_show(struct seq_file *m, void *data)
258 struct obd_device *dev = m->private;
259 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
264 seq_printf(m, "%u\n", osp->opd_sync_max_rpcs_in_progress);
269 * Change maximum number of RPCs in processing allowed
271 * \param[in] file proc file
272 * \param[in] buffer string which represents maximum number
273 * \param[in] count \a buffer length
274 * \param[in] off unused for single entry
275 * \retval \a count on success
276 * \retval negative number on error
279 osp_max_rpcs_in_progress_seq_write(struct file *file, const char __user *buffer,
280 size_t count, loff_t *off)
282 struct seq_file *m = file->private_data;
283 struct obd_device *dev = m->private;
284 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
291 rc = lprocfs_str_to_s64(buffer, count, &val);
295 if (val < 1 || val > INT_MAX)
298 osp->opd_sync_max_rpcs_in_progress = val;
302 LPROC_SEQ_FOPS(osp_max_rpcs_in_progress);
305 * Show number of objects to precreate next time
307 * \param[in] m seq_file handle
308 * \param[in] data unused for single entry
309 * \retval 0 on success
310 * \retval negative number on error
312 static int osp_create_count_seq_show(struct seq_file *m, void *data)
314 struct obd_device *obd = m->private;
315 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
317 if (osp == NULL || osp->opd_pre == NULL)
320 seq_printf(m, "%d\n", osp->opd_pre_create_count);
325 * Change number of objects to precreate next time
327 * \param[in] file proc file
328 * \param[in] buffer string which represents number of objects to precreate
329 * \param[in] count \a buffer length
330 * \param[in] off unused for single entry
331 * \retval \a count on success
332 * \retval negative number on error
335 osp_create_count_seq_write(struct file *file, const char __user *buffer,
336 size_t count, loff_t *off)
338 struct seq_file *m = file->private_data;
339 struct obd_device *obd = m->private;
340 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
344 if (osp == NULL || osp->opd_pre == NULL)
347 rc = lprocfs_str_to_s64(buffer, count, &val);
351 /* The MDT ALWAYS needs to limit the precreate count to
352 * OST_MAX_PRECREATE, and the constant cannot be changed
353 * because it is a value shared between the OSP and OST
354 * that is the maximum possible number of objects that will
355 * ever be handled by MDT->OST recovery processing.
357 * If the OST ever gets a request to delete more orphans,
358 * this implies that something has gone badly on the MDT
359 * and the OST will refuse to delete so much data from the
360 * filesystem as a safety measure. */
361 if (val < OST_MIN_PRECREATE || val > OST_MAX_PRECREATE)
363 if (val > osp->opd_pre_max_create_count)
366 for (i = 1; (i << 1) <= val; i <<= 1)
368 osp->opd_pre_create_count = i;
372 LPROC_SEQ_FOPS(osp_create_count);
375 * Show maximum number of objects to precreate
377 * \param[in] m seq_file handle
378 * \param[in] data unused for single entry
379 * \retval 0 on success
380 * \retval negative number on error
382 static int osp_max_create_count_seq_show(struct seq_file *m, void *data)
384 struct obd_device *obd = m->private;
385 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
387 if (osp == NULL || osp->opd_pre == NULL)
390 seq_printf(m, "%d\n", osp->opd_pre_max_create_count);
395 * Change maximum number of objects to precreate
397 * \param[in] file proc file
398 * \param[in] buffer string which represents maximum number
399 * \param[in] count \a buffer length
400 * \param[in] off unused for single entry
401 * \retval \a count on success
402 * \retval negative number on error
405 osp_max_create_count_seq_write(struct file *file, const char __user *buffer,
406 size_t count, loff_t *off)
408 struct seq_file *m = file->private_data;
409 struct obd_device *obd = m->private;
410 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
414 if (osp == NULL || osp->opd_pre == NULL)
417 rc = lprocfs_str_to_s64(buffer, count, &val);
421 if (val < 0 || val > INT_MAX)
423 if (val > OST_MAX_PRECREATE)
426 if (osp->opd_pre_create_count > val)
427 osp->opd_pre_create_count = val;
429 osp->opd_pre_max_create_count = val;
433 LPROC_SEQ_FOPS(osp_max_create_count);
436 * Show last id to assign in creation
438 * \param[in] m seq_file handle
439 * \param[in] data unused for single entry
440 * \retval 0 on success
441 * \retval negative number on error
443 static int osp_prealloc_next_id_seq_show(struct seq_file *m, void *data)
445 struct obd_device *obd = m->private;
446 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
450 if (osp == NULL || osp->opd_pre == NULL)
453 fid = &osp->opd_pre_used_fid;
454 if (fid_is_idif(fid)) {
455 id = fid_idif_id(fid_seq(fid), fid_oid(fid), fid_ver(fid));
458 id = unlikely(fid_oid(fid) == LUSTRE_DATA_SEQ_MAX_WIDTH) ?
459 1 : fid_oid(fid) + 1;
462 seq_printf(m, "%llu\n", id);
465 LPROC_SEQ_FOPS_RO(osp_prealloc_next_id);
468 * Show last created id OST reported
470 * \param[in] m seq_file handle
471 * \param[in] data unused for single entry
472 * \retval 0 on success
473 * \retval negative number on error
475 static int osp_prealloc_last_id_seq_show(struct seq_file *m, void *data)
477 struct obd_device *obd = m->private;
478 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
482 if (osp == NULL || osp->opd_pre == NULL)
484 fid = &osp->opd_pre_last_created_fid;
485 id = fid_is_idif(fid) ?
486 fid_idif_id(fid_seq(fid), fid_oid(fid), fid_ver(fid)) :
489 seq_printf(m, "%llu\n", id);
492 LPROC_SEQ_FOPS_RO(osp_prealloc_last_id);
495 * Show next FID sequence to precreate
497 * \param[in] m seq_file handle
498 * \param[in] data unused for single entry
499 * \retval 0 on success
500 * \retval negative number on error
502 static int osp_prealloc_next_seq_seq_show(struct seq_file *m, void *data)
504 struct obd_device *obd = m->private;
505 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
508 if (osp == NULL || osp->opd_pre == NULL)
511 fid = &osp->opd_pre_used_fid;
512 seq_printf(m, "%#llx\n", fid_is_idif(fid) ?
513 fid_seq(fid) & (~0xffff) : fid_seq(fid));
517 LPROC_SEQ_FOPS_RO(osp_prealloc_next_seq);
520 * Show last created FID sequence OST reported
522 * \param[in] m seq_file handle
523 * \param[in] data unused for single entry
524 * \retval 0 on success
525 * \retval negative number on error
527 static int osp_prealloc_last_seq_seq_show(struct seq_file *m, void *data)
529 struct obd_device *obd = m->private;
530 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
533 if (osp == NULL || osp->opd_pre == NULL)
536 fid = &osp->opd_pre_last_created_fid;
537 seq_printf(m, "%#llx\n", fid_is_idif(fid) ?
538 fid_seq(fid) & (~0xffff) : fid_seq(fid));
542 LPROC_SEQ_FOPS_RO(osp_prealloc_last_seq);
545 * Show the number of ids reserved by declare
547 * \param[in] m seq_file handle
548 * \param[in] data unused for single entry
549 * \retval 0 on success
550 * \retval negative number on error
552 static int osp_prealloc_reserved_seq_show(struct seq_file *m, void *data)
554 struct obd_device *obd = m->private;
555 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
557 if (osp == NULL || osp->opd_pre == NULL)
560 seq_printf(m, "%llu\n", osp->opd_pre_reserved);
563 LPROC_SEQ_FOPS_RO(osp_prealloc_reserved);
566 * Show interval (in seconds) to update statfs data
568 * \param[in] m seq_file handle
569 * \param[in] data unused for single entry
570 * \retval 0 on success
571 * \retval negative number on error
573 static int osp_maxage_seq_show(struct seq_file *m, void *data)
575 struct obd_device *dev = m->private;
576 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
581 seq_printf(m, "%u\n", osp->opd_statfs_maxage);
586 * Change interval to update statfs data
588 * \param[in] file proc file
589 * \param[in] buffer string which represents statfs interval (in seconds)
590 * \param[in] count \a buffer length
591 * \param[in] off unused for single entry
592 * \retval \a count on success
593 * \retval negative number on error
596 osp_maxage_seq_write(struct file *file, const char __user *buffer,
597 size_t count, loff_t *off)
599 struct seq_file *m = file->private_data;
600 struct obd_device *dev = m->private;
601 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
608 rc = lprocfs_str_to_s64(buffer, count, &val);
612 if (val < 1 || val > INT_MAX)
615 osp->opd_statfs_maxage = val;
619 LPROC_SEQ_FOPS(osp_maxage);
622 * Show current precreation status: output 0 means success, otherwise negative
625 * \param[in] m seq_file handle
626 * \param[in] data unused for single entry
627 * \retval 0 on success
628 * \retval negative number on error
630 static int osp_pre_status_seq_show(struct seq_file *m, void *data)
632 struct obd_device *dev = m->private;
633 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
635 if (osp == NULL || osp->opd_pre == NULL)
638 seq_printf(m, "%d\n", osp->opd_pre_status);
641 LPROC_SEQ_FOPS_RO(osp_pre_status);
644 * Show the number of RPCs in processing (including uncommitted by OST) plus
645 * changes to sync, i.e. this is the total number of changes OST needs to apply
648 * This counter is used to determine if OST has space returned. A zero value
649 * indicates that OST storage space consumed by destroyed objects has been freed
650 * on disk, the associated llog records have been cleared, and no synchronous
651 * RPC are being processed.
653 * \param[in] m seq_file handle
654 * \param[in] data unused for single entry
655 * \retval 0 on success
656 * \retval negative number on error
658 static int osp_destroys_in_flight_seq_show(struct seq_file *m, void *data)
660 struct obd_device *dev = m->private;
661 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
666 seq_printf(m, "%u\n",
667 atomic_read(&osp->opd_sync_rpcs_in_progress) +
668 atomic_read(&osp->opd_sync_changes));
671 LPROC_SEQ_FOPS_RO(osp_destroys_in_flight);
674 * Show changes synced from previous mount
676 * \param[in] m seq_file handle
677 * \param[in] data unused for single entry
678 * \retval 0 on success
679 * \retval negative number on error
681 static int osp_old_sync_processed_seq_show(struct seq_file *m, void *data)
683 struct obd_device *dev = m->private;
684 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
689 seq_printf(m, "%d\n", osp->opd_sync_prev_done);
692 LPROC_SEQ_FOPS_RO(osp_old_sync_processed);
695 * Show maximum number of RPCs in flight
697 * \param[in] m seq_file handle
698 * \param[in] data unused for single entry
699 * \retval 0 on success
700 * \retval negative number on error
703 osp_lfsck_max_rpcs_in_flight_seq_show(struct seq_file *m, void *data)
705 struct obd_device *dev = m->private;
708 max = obd_get_max_rpcs_in_flight(&dev->u.cli);
709 seq_printf(m, "%u\n", max);
714 * Change maximum number of RPCs in flight
716 * \param[in] file proc file
717 * \param[in] buffer string which represents maximum number of RPCs in flight
718 * \param[in] count \a buffer length
719 * \param[in] off unused for single entry
720 * \retval \a count on success
721 * \retval negative number on error
724 osp_lfsck_max_rpcs_in_flight_seq_write(struct file *file,
725 const char __user *buffer,
726 size_t count, loff_t *off)
728 struct seq_file *m = file->private_data;
729 struct obd_device *dev = m->private;
733 rc = lprocfs_str_to_s64(buffer, count, &val);
738 rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val);
745 LPROC_SEQ_FOPS(osp_lfsck_max_rpcs_in_flight);
747 LPROC_SEQ_FOPS_WO_TYPE(osp, ping);
748 LPROC_SEQ_FOPS_RO_TYPE(osp, connect_flags);
749 LPROC_SEQ_FOPS_RO_TYPE(osp, server_uuid);
750 LPROC_SEQ_FOPS_RO_TYPE(osp, conn_uuid);
752 LPROC_SEQ_FOPS_RO_TYPE(osp, timeouts);
754 LPROC_SEQ_FOPS_RW_TYPE(osp, import);
755 LPROC_SEQ_FOPS_RO_TYPE(osp, state);
758 * Show high watermark (in megabytes). If available free space at OST is grater
759 * than high watermark and object allocation for OST is disabled, enable it.
761 * \param[in] m seq_file handle
762 * \param[in] data unused for single entry
763 * \retval 0 on success
764 * \retval negative number on error
766 static int osp_reserved_mb_high_seq_show(struct seq_file *m, void *data)
768 struct obd_device *dev = m->private;
769 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
774 seq_printf(m, "%u\n", osp->opd_reserved_mb_high);
779 * Change high watermark
781 * \param[in] file proc file
782 * \param[in] buffer string which represents new value (in megabytes)
783 * \param[in] count \a buffer length
784 * \param[in] off unused for single entry
785 * \retval \a count on success
786 * \retval negative number on error
789 osp_reserved_mb_high_seq_write(struct file *file, const char __user *buffer,
790 size_t count, loff_t *off)
792 struct seq_file *m = file->private_data;
793 struct obd_device *dev = m->private;
794 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
801 rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
808 spin_lock(&osp->opd_pre_lock);
809 osp->opd_reserved_mb_high = val;
810 if (val <= osp->opd_reserved_mb_low)
811 osp->opd_reserved_mb_low = val - 1;
812 spin_unlock(&osp->opd_pre_lock);
816 LPROC_SEQ_FOPS(osp_reserved_mb_high);
819 * Show low watermark (in megabytes). If available free space at OST is less
820 * than low watermark, object allocation for OST is disabled.
822 * \param[in] m seq_file handle
823 * \param[in] data unused for single entry
824 * \retval 0 on success
825 * \retval negative number on error
827 static int osp_reserved_mb_low_seq_show(struct seq_file *m, void *data)
829 struct obd_device *dev = m->private;
830 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
835 seq_printf(m, "%u\n", osp->opd_reserved_mb_low);
840 * Change low watermark
842 * \param[in] file proc file
843 * \param[in] buffer string which represents new value (in megabytes)
844 * \param[in] count \a buffer length
845 * \param[in] off unused for single entry
846 * \retval \a count on success
847 * \retval negative number on error
850 osp_reserved_mb_low_seq_write(struct file *file, const char __user *buffer,
851 size_t count, loff_t *off)
853 struct seq_file *m = file->private_data;
854 struct obd_device *dev = m->private;
855 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
862 rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
867 spin_lock(&osp->opd_pre_lock);
868 osp->opd_reserved_mb_low = val;
869 if (val >= osp->opd_reserved_mb_high)
870 osp->opd_reserved_mb_high = val + 1;
871 spin_unlock(&osp->opd_pre_lock);
875 LPROC_SEQ_FOPS(osp_reserved_mb_low);
877 static struct lprocfs_vars lprocfs_osp_obd_vars[] = {
879 .fops = &osp_ping_fops,
881 { .name = "connect_flags",
882 .fops = &osp_connect_flags_fops },
883 { .name = "ost_server_uuid",
884 .fops = &osp_server_uuid_fops },
885 { .name = "ost_conn_uuid",
886 .fops = &osp_conn_uuid_fops },
888 .fops = &osp_active_fops },
889 { .name = "max_rpcs_in_flight",
890 .fops = &osp_max_rpcs_in_flight_fops },
891 { .name = "max_rpcs_in_progress",
892 .fops = &osp_max_rpcs_in_progress_fops },
893 { .name = "create_count",
894 .fops = &osp_create_count_fops },
895 { .name = "max_create_count",
896 .fops = &osp_max_create_count_fops },
897 { .name = "prealloc_next_id",
898 .fops = &osp_prealloc_next_id_fops },
899 { .name = "prealloc_next_seq",
900 .fops = &osp_prealloc_next_seq_fops },
901 { .name = "prealloc_last_id",
902 .fops = &osp_prealloc_last_id_fops },
903 { .name = "prealloc_last_seq",
904 .fops = &osp_prealloc_last_seq_fops },
905 { .name = "prealloc_reserved",
906 .fops = &osp_prealloc_reserved_fops },
907 { .name = "timeouts",
908 .fops = &osp_timeouts_fops },
910 .fops = &osp_import_fops },
912 .fops = &osp_state_fops },
914 .fops = &osp_maxage_fops },
915 { .name = "prealloc_status",
916 .fops = &osp_pre_status_fops },
917 { .name = "sync_changes",
918 .fops = &osp_sync_changes_fops },
919 { .name = "sync_in_flight",
920 .fops = &osp_sync_rpcs_in_flight_fops },
921 { .name = "sync_in_progress",
922 .fops = &osp_sync_rpcs_in_progress_fops },
923 { .name = "old_sync_processed",
924 .fops = &osp_old_sync_processed_fops },
925 { .name = "reserved_mb_high",
926 .fops = &osp_reserved_mb_high_fops },
927 { .name = "reserved_mb_low",
928 .fops = &osp_reserved_mb_low_fops },
930 /* for compatibility reasons */
931 { .name = "destroys_in_flight",
932 .fops = &osp_destroys_in_flight_fops },
933 { .name = "lfsck_max_rpcs_in_flight",
934 .fops = &osp_lfsck_max_rpcs_in_flight_fops },
938 static struct lprocfs_vars lprocfs_osp_md_vars[] = {
940 .fops = &osp_ping_fops,
942 { .name = "connect_flags",
943 .fops = &osp_connect_flags_fops },
944 { .name = "mdt_server_uuid",
945 .fops = &osp_server_uuid_fops },
946 { .name = "mdt_conn_uuid",
947 .fops = &osp_conn_uuid_fops },
949 .fops = &osp_active_fops },
950 { .name = "max_rpcs_in_flight",
951 .fops = &osp_max_rpcs_in_flight_fops },
952 { .name = "max_rpcs_in_progress",
953 .fops = &osp_max_rpcs_in_progress_fops },
954 { .name = "timeouts",
955 .fops = &osp_timeouts_fops },
957 .fops = &osp_import_fops },
959 .fops = &osp_state_fops },
961 .fops = &osp_maxage_fops },
962 { .name = "prealloc_status",
963 .fops = &osp_pre_status_fops },
965 /* for compatibility reasons */
966 { .name = "destroys_in_flight",
967 .fops = &osp_destroys_in_flight_fops },
968 { .name = "lfsck_max_rpcs_in_flight",
969 .fops = &osp_lfsck_max_rpcs_in_flight_fops },
973 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_blksize);
974 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytestotal);
975 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytesfree);
976 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytesavail);
977 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_filestotal);
978 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_filesfree);
980 static struct lprocfs_vars lprocfs_osp_osd_vars[] = {
981 { .name = "blocksize",
982 .fops = &osp_dt_blksize_fops },
983 { .name = "kbytestotal",
984 .fops = &osp_dt_kbytestotal_fops },
985 { .name = "kbytesfree",
986 .fops = &osp_dt_kbytesfree_fops },
987 { .name = "kbytesavail",
988 .fops = &osp_dt_kbytesavail_fops },
989 { .name = "filestotal",
990 .fops = &osp_dt_filestotal_fops },
991 { .name = "filesfree",
992 .fops = &osp_dt_filesfree_fops },
997 * Initialize OSP lprocfs
999 * param[in] osp OSP device
1001 void osp_lprocfs_init(struct osp_device *osp)
1003 struct obd_device *obd = osp->opd_obd;
1004 struct proc_dir_entry *osc_proc_dir = NULL;
1005 struct obd_type *type;
1008 if (osp->opd_connect_mdt)
1009 obd->obd_vars = lprocfs_osp_md_vars;
1011 obd->obd_vars = lprocfs_osp_obd_vars;
1012 if (lprocfs_obd_setup(obd, true) != 0)
1015 rc = lprocfs_add_vars(obd->obd_proc_entry, lprocfs_osp_osd_vars,
1018 CERROR("%s: can't register in lprocfs, rc %d\n",
1023 sptlrpc_lprocfs_cliobd_attach(obd);
1024 ptlrpc_lprocfs_register_obd(obd);
1026 if (osp->opd_connect_mdt || !strstr(obd->obd_name, "osc"))
1029 /* If the real OSC is present which is the case for setups
1030 * with both server and clients on the same node then use
1031 * the OSC's proc root */
1032 type = class_search_type(LUSTRE_OSC_NAME);
1033 if (type != NULL && type->typ_procroot != NULL)
1034 osc_proc_dir = type->typ_procroot;
1036 osc_proc_dir = obd->obd_type->typ_procsym;
1038 if (osc_proc_dir == NULL)
1041 /* for compatibility we link old procfs's OSC entries to osp ones */
1042 osp->opd_symlink = lprocfs_add_symlink(obd->obd_name, osc_proc_dir,
1043 "../osp/%s", obd->obd_name);
1044 if (osp->opd_symlink == NULL)
1045 CERROR("cannot create OSC symlink for /proc/fs/lustre/osp/%s\n",
1049 #endif /* CONFIG_PROC_FS */