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);
448 if (osp == NULL || osp->opd_pre == NULL)
451 seq_printf(m, "%u\n", fid_oid(&osp->opd_pre_used_fid) + 1);
454 LPROC_SEQ_FOPS_RO(osp_prealloc_next_id);
457 * Show last created id OST reported
459 * \param[in] m seq_file handle
460 * \param[in] data unused for single entry
461 * \retval 0 on success
462 * \retval negative number on error
464 static int osp_prealloc_last_id_seq_show(struct seq_file *m, void *data)
466 struct obd_device *obd = m->private;
467 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
469 if (osp == NULL || osp->opd_pre == NULL)
472 seq_printf(m, "%u\n", fid_oid(&osp->opd_pre_last_created_fid));
475 LPROC_SEQ_FOPS_RO(osp_prealloc_last_id);
478 * Show next FID sequence to precreate
480 * \param[in] m seq_file handle
481 * \param[in] data unused for single entry
482 * \retval 0 on success
483 * \retval negative number on error
485 static int osp_prealloc_next_seq_seq_show(struct seq_file *m, void *data)
487 struct obd_device *obd = m->private;
488 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
490 if (osp == NULL || osp->opd_pre == NULL)
493 seq_printf(m, "%#llx\n", fid_seq(&osp->opd_pre_used_fid));
496 LPROC_SEQ_FOPS_RO(osp_prealloc_next_seq);
499 * Show last created FID sequence OST reported
501 * \param[in] m seq_file handle
502 * \param[in] data unused for single entry
503 * \retval 0 on success
504 * \retval negative number on error
506 static int osp_prealloc_last_seq_seq_show(struct seq_file *m, void *data)
508 struct obd_device *obd = m->private;
509 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
511 if (osp == NULL || osp->opd_pre == NULL)
514 seq_printf(m, "%#llx\n",
515 fid_seq(&osp->opd_pre_last_created_fid));
518 LPROC_SEQ_FOPS_RO(osp_prealloc_last_seq);
521 * Show the number of ids reserved by declare
523 * \param[in] m seq_file handle
524 * \param[in] data unused for single entry
525 * \retval 0 on success
526 * \retval negative number on error
528 static int osp_prealloc_reserved_seq_show(struct seq_file *m, void *data)
530 struct obd_device *obd = m->private;
531 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
533 if (osp == NULL || osp->opd_pre == NULL)
536 seq_printf(m, "%llu\n", osp->opd_pre_reserved);
539 LPROC_SEQ_FOPS_RO(osp_prealloc_reserved);
542 * Show interval (in seconds) to update statfs data
544 * \param[in] m seq_file handle
545 * \param[in] data unused for single entry
546 * \retval 0 on success
547 * \retval negative number on error
549 static int osp_maxage_seq_show(struct seq_file *m, void *data)
551 struct obd_device *dev = m->private;
552 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
557 seq_printf(m, "%u\n", osp->opd_statfs_maxage);
562 * Change interval to update statfs data
564 * \param[in] file proc file
565 * \param[in] buffer string which represents statfs interval (in seconds)
566 * \param[in] count \a buffer length
567 * \param[in] off unused for single entry
568 * \retval \a count on success
569 * \retval negative number on error
572 osp_maxage_seq_write(struct file *file, const char __user *buffer,
573 size_t count, loff_t *off)
575 struct seq_file *m = file->private_data;
576 struct obd_device *dev = m->private;
577 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
584 rc = lprocfs_str_to_s64(buffer, count, &val);
588 if (val < 1 || val > INT_MAX)
591 osp->opd_statfs_maxage = val;
595 LPROC_SEQ_FOPS(osp_maxage);
598 * Show current precreation status: output 0 means success, otherwise negative
601 * \param[in] m seq_file handle
602 * \param[in] data unused for single entry
603 * \retval 0 on success
604 * \retval negative number on error
606 static int osp_pre_status_seq_show(struct seq_file *m, void *data)
608 struct obd_device *dev = m->private;
609 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
611 if (osp == NULL || osp->opd_pre == NULL)
614 seq_printf(m, "%d\n", osp->opd_pre_status);
617 LPROC_SEQ_FOPS_RO(osp_pre_status);
620 * Show the number of RPCs in processing (including uncommitted by OST) plus
621 * changes to sync, i.e. this is the total number of changes OST needs to apply
624 * This counter is used to determine if OST has space returned. A zero value
625 * indicates that OST storage space consumed by destroyed objects has been freed
626 * on disk, the associated llog records have been cleared, and no synchronous
627 * RPC are being processed.
629 * \param[in] m seq_file handle
630 * \param[in] data unused for single entry
631 * \retval 0 on success
632 * \retval negative number on error
634 static int osp_destroys_in_flight_seq_show(struct seq_file *m, void *data)
636 struct obd_device *dev = m->private;
637 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
642 seq_printf(m, "%u\n",
643 atomic_read(&osp->opd_sync_rpcs_in_progress) +
644 atomic_read(&osp->opd_sync_changes));
647 LPROC_SEQ_FOPS_RO(osp_destroys_in_flight);
650 * Show changes synced from previous mount
652 * \param[in] m seq_file handle
653 * \param[in] data unused for single entry
654 * \retval 0 on success
655 * \retval negative number on error
657 static int osp_old_sync_processed_seq_show(struct seq_file *m, void *data)
659 struct obd_device *dev = m->private;
660 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
665 seq_printf(m, "%d\n", osp->opd_sync_prev_done);
668 LPROC_SEQ_FOPS_RO(osp_old_sync_processed);
671 * Show maximum number of RPCs in flight
673 * \param[in] m seq_file handle
674 * \param[in] data unused for single entry
675 * \retval 0 on success
676 * \retval negative number on error
679 osp_lfsck_max_rpcs_in_flight_seq_show(struct seq_file *m, void *data)
681 struct obd_device *dev = m->private;
684 max = obd_get_max_rpcs_in_flight(&dev->u.cli);
685 seq_printf(m, "%u\n", max);
690 * Change maximum number of RPCs in flight
692 * \param[in] file proc file
693 * \param[in] buffer string which represents maximum number of RPCs in flight
694 * \param[in] count \a buffer length
695 * \param[in] off unused for single entry
696 * \retval \a count on success
697 * \retval negative number on error
700 osp_lfsck_max_rpcs_in_flight_seq_write(struct file *file,
701 const char __user *buffer,
702 size_t count, loff_t *off)
704 struct seq_file *m = file->private_data;
705 struct obd_device *dev = m->private;
709 rc = lprocfs_str_to_s64(buffer, count, &val);
714 rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val);
721 LPROC_SEQ_FOPS(osp_lfsck_max_rpcs_in_flight);
723 LPROC_SEQ_FOPS_WO_TYPE(osp, ping);
724 LPROC_SEQ_FOPS_RO_TYPE(osp, uuid);
725 LPROC_SEQ_FOPS_RO_TYPE(osp, connect_flags);
726 LPROC_SEQ_FOPS_RO_TYPE(osp, server_uuid);
727 LPROC_SEQ_FOPS_RO_TYPE(osp, conn_uuid);
729 LPROC_SEQ_FOPS_RO_TYPE(osp, timeouts);
731 LPROC_SEQ_FOPS_RW_TYPE(osp, import);
732 LPROC_SEQ_FOPS_RO_TYPE(osp, state);
735 * Show high watermark (in megabytes). If available free space at OST is grater
736 * than high watermark and object allocation for OST is disabled, enable it.
738 * \param[in] m seq_file handle
739 * \param[in] data unused for single entry
740 * \retval 0 on success
741 * \retval negative number on error
743 static int osp_reserved_mb_high_seq_show(struct seq_file *m, void *data)
745 struct obd_device *dev = m->private;
746 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
751 seq_printf(m, "%u\n", osp->opd_reserved_mb_high);
756 * Change high watermark
758 * \param[in] file proc file
759 * \param[in] buffer string which represents new value (in megabytes)
760 * \param[in] count \a buffer length
761 * \param[in] off unused for single entry
762 * \retval \a count on success
763 * \retval negative number on error
766 osp_reserved_mb_high_seq_write(struct file *file, const char __user *buffer,
767 size_t count, loff_t *off)
769 struct seq_file *m = file->private_data;
770 struct obd_device *dev = m->private;
771 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
778 rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
785 spin_lock(&osp->opd_pre_lock);
786 osp->opd_reserved_mb_high = val;
787 if (val <= osp->opd_reserved_mb_low)
788 osp->opd_reserved_mb_low = val - 1;
789 spin_unlock(&osp->opd_pre_lock);
793 LPROC_SEQ_FOPS(osp_reserved_mb_high);
796 * Show low watermark (in megabytes). If available free space at OST is less
797 * than low watermark, object allocation for OST is disabled.
799 * \param[in] m seq_file handle
800 * \param[in] data unused for single entry
801 * \retval 0 on success
802 * \retval negative number on error
804 static int osp_reserved_mb_low_seq_show(struct seq_file *m, void *data)
806 struct obd_device *dev = m->private;
807 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
812 seq_printf(m, "%u\n", osp->opd_reserved_mb_low);
817 * Change low watermark
819 * \param[in] file proc file
820 * \param[in] buffer string which represents new value (in megabytes)
821 * \param[in] count \a buffer length
822 * \param[in] off unused for single entry
823 * \retval \a count on success
824 * \retval negative number on error
827 osp_reserved_mb_low_seq_write(struct file *file, const char __user *buffer,
828 size_t count, loff_t *off)
830 struct seq_file *m = file->private_data;
831 struct obd_device *dev = m->private;
832 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
839 rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
844 spin_lock(&osp->opd_pre_lock);
845 osp->opd_reserved_mb_low = val;
846 if (val >= osp->opd_reserved_mb_high)
847 osp->opd_reserved_mb_high = val + 1;
848 spin_unlock(&osp->opd_pre_lock);
852 LPROC_SEQ_FOPS(osp_reserved_mb_low);
854 static struct lprocfs_vars lprocfs_osp_obd_vars[] = {
856 .fops = &osp_uuid_fops },
858 .fops = &osp_ping_fops,
860 { .name = "connect_flags",
861 .fops = &osp_connect_flags_fops },
862 { .name = "ost_server_uuid",
863 .fops = &osp_server_uuid_fops },
864 { .name = "ost_conn_uuid",
865 .fops = &osp_conn_uuid_fops },
867 .fops = &osp_active_fops },
868 { .name = "max_rpcs_in_flight",
869 .fops = &osp_max_rpcs_in_flight_fops },
870 { .name = "max_rpcs_in_progress",
871 .fops = &osp_max_rpcs_in_progress_fops },
872 { .name = "create_count",
873 .fops = &osp_create_count_fops },
874 { .name = "max_create_count",
875 .fops = &osp_max_create_count_fops },
876 { .name = "prealloc_next_id",
877 .fops = &osp_prealloc_next_id_fops },
878 { .name = "prealloc_next_seq",
879 .fops = &osp_prealloc_next_seq_fops },
880 { .name = "prealloc_last_id",
881 .fops = &osp_prealloc_last_id_fops },
882 { .name = "prealloc_last_seq",
883 .fops = &osp_prealloc_last_seq_fops },
884 { .name = "prealloc_reserved",
885 .fops = &osp_prealloc_reserved_fops },
886 { .name = "timeouts",
887 .fops = &osp_timeouts_fops },
889 .fops = &osp_import_fops },
891 .fops = &osp_state_fops },
893 .fops = &osp_maxage_fops },
894 { .name = "prealloc_status",
895 .fops = &osp_pre_status_fops },
896 { .name = "sync_changes",
897 .fops = &osp_sync_changes_fops },
898 { .name = "sync_in_flight",
899 .fops = &osp_sync_rpcs_in_flight_fops },
900 { .name = "sync_in_progress",
901 .fops = &osp_sync_rpcs_in_progress_fops },
902 { .name = "old_sync_processed",
903 .fops = &osp_old_sync_processed_fops },
904 { .name = "reserved_mb_high",
905 .fops = &osp_reserved_mb_high_fops },
906 { .name = "reserved_mb_low",
907 .fops = &osp_reserved_mb_low_fops },
909 /* for compatibility reasons */
910 { .name = "destroys_in_flight",
911 .fops = &osp_destroys_in_flight_fops },
912 { .name = "lfsck_max_rpcs_in_flight",
913 .fops = &osp_lfsck_max_rpcs_in_flight_fops },
917 static struct lprocfs_vars lprocfs_osp_md_vars[] = {
919 .fops = &osp_uuid_fops },
921 .fops = &osp_ping_fops,
923 { .name = "connect_flags",
924 .fops = &osp_connect_flags_fops },
925 { .name = "mdt_server_uuid",
926 .fops = &osp_server_uuid_fops },
927 { .name = "mdt_conn_uuid",
928 .fops = &osp_conn_uuid_fops },
930 .fops = &osp_active_fops },
931 { .name = "max_rpcs_in_flight",
932 .fops = &osp_max_rpcs_in_flight_fops },
933 { .name = "max_rpcs_in_progress",
934 .fops = &osp_max_rpcs_in_progress_fops },
935 { .name = "timeouts",
936 .fops = &osp_timeouts_fops },
938 .fops = &osp_import_fops },
940 .fops = &osp_state_fops },
942 .fops = &osp_maxage_fops },
943 { .name = "prealloc_status",
944 .fops = &osp_pre_status_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 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_blksize);
955 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytestotal);
956 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytesfree);
957 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytesavail);
958 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_filestotal);
959 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_filesfree);
961 static struct lprocfs_vars lprocfs_osp_osd_vars[] = {
962 { .name = "blocksize",
963 .fops = &osp_dt_blksize_fops },
964 { .name = "kbytestotal",
965 .fops = &osp_dt_kbytestotal_fops },
966 { .name = "kbytesfree",
967 .fops = &osp_dt_kbytesfree_fops },
968 { .name = "kbytesavail",
969 .fops = &osp_dt_kbytesavail_fops },
970 { .name = "filestotal",
971 .fops = &osp_dt_filestotal_fops },
972 { .name = "filesfree",
973 .fops = &osp_dt_filesfree_fops },
978 * Initialize OSP lprocfs
980 * param[in] osp OSP device
982 void osp_lprocfs_init(struct osp_device *osp)
984 struct obd_device *obd = osp->opd_obd;
985 struct proc_dir_entry *osc_proc_dir = NULL;
986 struct obd_type *type;
989 if (osp->opd_connect_mdt)
990 obd->obd_vars = lprocfs_osp_md_vars;
992 obd->obd_vars = lprocfs_osp_obd_vars;
993 if (lprocfs_obd_setup(obd) != 0)
996 rc = lprocfs_add_vars(obd->obd_proc_entry, lprocfs_osp_osd_vars,
999 CERROR("%s: can't register in lprocfs, rc %d\n",
1004 sptlrpc_lprocfs_cliobd_attach(obd);
1005 ptlrpc_lprocfs_register_obd(obd);
1007 if (osp->opd_connect_mdt || !strstr(obd->obd_name, "osc"))
1010 /* If the real OSC is present which is the case for setups
1011 * with both server and clients on the same node then use
1012 * the OSC's proc root */
1013 type = class_search_type(LUSTRE_OSC_NAME);
1014 if (type != NULL && type->typ_procroot != NULL)
1015 osc_proc_dir = type->typ_procroot;
1017 osc_proc_dir = obd->obd_type->typ_procsym;
1019 if (osc_proc_dir == NULL)
1022 /* for compatibility we link old procfs's OSC entries to osp ones */
1023 osp->opd_symlink = lprocfs_add_symlink(obd->obd_name, osc_proc_dir,
1024 "../osp/%s", obd->obd_name);
1025 if (osp->opd_symlink == NULL)
1026 CERROR("cannot create OSC symlink for /proc/fs/lustre/osp/%s\n",
1030 #endif /* CONFIG_PROC_FS */