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, 2015, 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;
57 LPROCFS_CLIMP_CHECK(dev);
58 rc = seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
59 LPROCFS_CLIMP_EXIT(dev);
64 * Activate/Deactivate OSP
66 * \param[in] file proc file
67 * \param[in] buffer string, which is "1" or "0" to activate/deactivate OSP
68 * \param[in] count \a buffer length
69 * \param[in] off unused for single entry
70 * \retval \a count on success
71 * \retval negative number on error
74 osp_active_seq_write(struct file *file, const char __user *buffer,
75 size_t count, loff_t *off)
77 struct seq_file *m = file->private_data;
78 struct obd_device *dev = m->private;
81 rc = lprocfs_write_helper(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 %d: 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_syn_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 return seq_printf(m, "%u\n", osp->opd_syn_rpc_in_flight);
118 LPROC_SEQ_FOPS_RO(osp_syn_in_flight);
121 * Show number of RPCs in processing (including uncommitted by OST)
123 * \param[in] m seq_file handle
124 * \param[in] data unused for single entry
125 * \retval 0 on success
126 * \retval negative number on error
128 static int osp_syn_in_prog_seq_show(struct seq_file *m, void *data)
130 struct obd_device *dev = m->private;
131 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
136 return seq_printf(m, "%u\n", osp->opd_syn_rpc_in_progress);
138 LPROC_SEQ_FOPS_RO(osp_syn_in_prog);
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_syn_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 return seq_printf(m, "%lu\n", osp->opd_syn_changes);
162 * \param[in] file proc file
163 * \param[in] buffer unused because any input will do
164 * \param[in] count \a buffer length
165 * \param[in] off unused for single entry
166 * \retval \a count on success
167 * \retval negative number on error
169 static ssize_t osp_syn_changes_seq_write(struct file *file,
170 const char __user *buffer,
171 size_t count, loff_t *off)
173 struct seq_file *m = file->private_data;
174 struct obd_device *dev = m->private;
175 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
179 rc = lu_env_init(&env, LCT_LOCAL);
183 rc = dt_sync(&env, &osp->opd_dt_dev);
186 return rc == 0 ? count : rc;
188 LPROC_SEQ_FOPS(osp_syn_changes);
191 * Show maximum number of RPCs in flight allowed
193 * \param[in] m seq_file handle
194 * \param[in] data unused for single entry
195 * \retval 0 on success
196 * \retval negative number on error
198 static int osp_max_rpcs_in_flight_seq_show(struct seq_file *m, void *data)
200 struct obd_device *dev = m->private;
201 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
206 return seq_printf(m, "%u\n", osp->opd_syn_max_rpc_in_flight);
210 * Change maximum number of RPCs in flight allowed
212 * \param[in] file proc file
213 * \param[in] buffer string which represents maximum number
214 * \param[in] count \a buffer length
215 * \param[in] off unused for single entry
216 * \retval \a count on success
217 * \retval negative number on error
220 osp_max_rpcs_in_flight_seq_write(struct file *file, const char __user *buffer,
221 size_t count, loff_t *off)
223 struct seq_file *m = file->private_data;
224 struct obd_device *dev = m->private;
225 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
231 rc = lprocfs_write_helper(buffer, count, &val);
238 osp->opd_syn_max_rpc_in_flight = val;
241 LPROC_SEQ_FOPS(osp_max_rpcs_in_flight);
244 * Show maximum number of RPCs in processing allowed
246 * \param[in] m seq_file handle
247 * \param[in] data unused
248 * \retval 0 on success
249 * \retval negative number on error
251 static int osp_max_rpcs_in_prog_seq_show(struct seq_file *m, void *data)
253 struct obd_device *dev = m->private;
254 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
259 return seq_printf(m, "%u\n", osp->opd_syn_max_rpc_in_progress);
263 * Change maximum number of RPCs in processing allowed
265 * \param[in] file proc file
266 * \param[in] buffer string which represents maximum number
267 * \param[in] count \a buffer length
268 * \param[in] off unused for single entry
269 * \retval \a count on success
270 * \retval negative number on error
273 osp_max_rpcs_in_prog_seq_write(struct file *file, const char __user *buffer,
274 size_t count, loff_t *off)
276 struct seq_file *m = file->private_data;
277 struct obd_device *dev = m->private;
278 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
284 rc = lprocfs_write_helper(buffer, count, &val);
291 osp->opd_syn_max_rpc_in_progress = val;
295 LPROC_SEQ_FOPS(osp_max_rpcs_in_prog);
298 * Show number of objects to precreate next time
300 * \param[in] m seq_file handle
301 * \param[in] data unused for single entry
302 * \retval 0 on success
303 * \retval negative number on error
305 static int osp_create_count_seq_show(struct seq_file *m, void *data)
307 struct obd_device *obd = m->private;
308 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
310 if (osp == NULL || osp->opd_pre == NULL)
313 return seq_printf(m, "%d\n", osp->opd_pre_create_count);
317 * Change number of objects to precreate next time
319 * \param[in] file proc file
320 * \param[in] buffer string which represents number of objects to precreate
321 * \param[in] count \a buffer length
322 * \param[in] off unused for single entry
323 * \retval \a count on success
324 * \retval negative number on error
327 osp_create_count_seq_write(struct file *file, const char __user *buffer,
328 size_t count, loff_t *off)
330 struct seq_file *m = file->private_data;
331 struct obd_device *obd = m->private;
332 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
335 if (osp == NULL || osp->opd_pre == NULL)
338 rc = lprocfs_write_helper(buffer, count, &val);
342 /* The MDT ALWAYS needs to limit the precreate count to
343 * OST_MAX_PRECREATE, and the constant cannot be changed
344 * because it is a value shared between the OSP and OST
345 * that is the maximum possible number of objects that will
346 * ever be handled by MDT->OST recovery processing.
348 * If the OST ever gets a request to delete more orphans,
349 * this implies that something has gone badly on the MDT
350 * and the OST will refuse to delete so much data from the
351 * filesystem as a safety measure. */
352 if (val < OST_MIN_PRECREATE || val > OST_MAX_PRECREATE)
354 if (val > osp->opd_pre_max_create_count)
357 for (i = 1; (i << 1) <= val; i <<= 1)
359 osp->opd_pre_create_count = i;
363 LPROC_SEQ_FOPS(osp_create_count);
366 * Show maximum number of objects to precreate
368 * \param[in] m seq_file handle
369 * \param[in] data unused for single entry
370 * \retval 0 on success
371 * \retval negative number on error
373 static int osp_max_create_count_seq_show(struct seq_file *m, void *data)
375 struct obd_device *obd = m->private;
376 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
378 if (osp == NULL || osp->opd_pre == NULL)
381 return seq_printf(m, "%d\n", osp->opd_pre_max_create_count);
385 * Change maximum number of objects to precreate
387 * \param[in] file proc file
388 * \param[in] buffer string which represents maximum number
389 * \param[in] count \a buffer length
390 * \param[in] off unused for single entry
391 * \retval \a count on success
392 * \retval negative number on error
395 osp_max_create_count_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 osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
403 if (osp == NULL || osp->opd_pre == NULL)
406 rc = lprocfs_write_helper(buffer, count, &val);
412 if (val > OST_MAX_PRECREATE)
415 if (osp->opd_pre_create_count > val)
416 osp->opd_pre_create_count = val;
418 osp->opd_pre_max_create_count = val;
422 LPROC_SEQ_FOPS(osp_max_create_count);
425 * Show last id to assign in creation
427 * \param[in] m seq_file handle
428 * \param[in] data unused for single entry
429 * \retval 0 on success
430 * \retval negative number on error
432 static int osp_prealloc_next_id_seq_show(struct seq_file *m, void *data)
434 struct obd_device *obd = m->private;
435 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
437 if (osp == NULL || osp->opd_pre == NULL)
440 return seq_printf(m, "%u\n", fid_oid(&osp->opd_pre_used_fid) + 1);
442 LPROC_SEQ_FOPS_RO(osp_prealloc_next_id);
445 * Show last created id OST reported
447 * \param[in] m seq_file handle
448 * \param[in] data unused for single entry
449 * \retval 0 on success
450 * \retval negative number on error
452 static int osp_prealloc_last_id_seq_show(struct seq_file *m, void *data)
454 struct obd_device *obd = m->private;
455 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
457 if (osp == NULL || osp->opd_pre == NULL)
460 return seq_printf(m, "%u\n", fid_oid(&osp->opd_pre_last_created_fid));
462 LPROC_SEQ_FOPS_RO(osp_prealloc_last_id);
465 * Show next FID sequence to precreate
467 * \param[in] m seq_file handle
468 * \param[in] data unused for single entry
469 * \retval 0 on success
470 * \retval negative number on error
472 static int osp_prealloc_next_seq_seq_show(struct seq_file *m, void *data)
474 struct obd_device *obd = m->private;
475 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
477 if (osp == NULL || osp->opd_pre == NULL)
480 return seq_printf(m, LPX64"\n", fid_seq(&osp->opd_pre_used_fid));
482 LPROC_SEQ_FOPS_RO(osp_prealloc_next_seq);
485 * Show last created FID sequence OST reported
487 * \param[in] m seq_file handle
488 * \param[in] data unused for single entry
489 * \retval 0 on success
490 * \retval negative number on error
492 static int osp_prealloc_last_seq_seq_show(struct seq_file *m, void *data)
494 struct obd_device *obd = m->private;
495 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
497 if (osp == NULL || osp->opd_pre == NULL)
500 return seq_printf(m, LPX64"\n",
501 fid_seq(&osp->opd_pre_last_created_fid));
503 LPROC_SEQ_FOPS_RO(osp_prealloc_last_seq);
506 * Show the number of ids reserved by declare
508 * \param[in] m seq_file handle
509 * \param[in] data unused for single entry
510 * \retval 0 on success
511 * \retval negative number on error
513 static int osp_prealloc_reserved_seq_show(struct seq_file *m, void *data)
515 struct obd_device *obd = m->private;
516 struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
518 if (osp == NULL || osp->opd_pre == NULL)
521 return seq_printf(m, LPU64"\n", osp->opd_pre_reserved);
523 LPROC_SEQ_FOPS_RO(osp_prealloc_reserved);
526 * Show interval (in seconds) to update statfs data
528 * \param[in] m seq_file handle
529 * \param[in] data unused for single entry
530 * \retval 0 on success
531 * \retval negative number on error
533 static int osp_maxage_seq_show(struct seq_file *m, void *data)
535 struct obd_device *dev = m->private;
536 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
541 return seq_printf(m, "%u\n", osp->opd_statfs_maxage);
545 * Change interval to update statfs data
547 * \param[in] file proc file
548 * \param[in] buffer string which represents statfs interval (in seconds)
549 * \param[in] count \a buffer length
550 * \param[in] off unused for single entry
551 * \retval \a count on success
552 * \retval negative number on error
555 osp_maxage_seq_write(struct file *file, const char __user *buffer,
556 size_t count, loff_t *off)
558 struct seq_file *m = file->private_data;
559 struct obd_device *dev = m->private;
560 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
566 rc = lprocfs_write_helper(buffer, count, &val);
573 osp->opd_statfs_maxage = val;
577 LPROC_SEQ_FOPS(osp_maxage);
580 * Show current precreation status: output 0 means success, otherwise negative
583 * \param[in] m seq_file handle
584 * \param[in] data unused for single entry
585 * \retval 0 on success
586 * \retval negative number on error
588 static int osp_pre_status_seq_show(struct seq_file *m, void *data)
590 struct obd_device *dev = m->private;
591 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
593 if (osp == NULL || osp->opd_pre == NULL)
596 return seq_printf(m, "%d\n", osp->opd_pre_status);
598 LPROC_SEQ_FOPS_RO(osp_pre_status);
601 * Show the number of RPCs in processing (including uncommitted by OST) plus
602 * changes to sync, i.e. this is the total number of changes OST needs to apply
605 * This counter is used to determine if OST has space returned. A zero value
606 * indicates that OST storage space consumed by destroyed objects has been freed
607 * on disk, the associated llog records have been cleared, and no synchronous
608 * RPC are being processed.
610 * \param[in] m seq_file handle
611 * \param[in] data unused for single entry
612 * \retval 0 on success
613 * \retval negative number on error
615 static int osp_destroys_in_flight_seq_show(struct seq_file *m, void *data)
617 struct obd_device *dev = m->private;
618 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
623 return seq_printf(m, "%lu\n",
624 osp->opd_syn_rpc_in_progress + osp->opd_syn_changes);
626 LPROC_SEQ_FOPS_RO(osp_destroys_in_flight);
629 * Show changes synced from previous mount
631 * \param[in] m seq_file handle
632 * \param[in] data unused for single entry
633 * \retval 0 on success
634 * \retval negative number on error
636 static int osp_old_sync_processed_seq_show(struct seq_file *m, void *data)
638 struct obd_device *dev = m->private;
639 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
644 return seq_printf(m, "%d\n", osp->opd_syn_prev_done);
646 LPROC_SEQ_FOPS_RO(osp_old_sync_processed);
649 * Show maximum number of RPCs in flight
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
657 osp_lfsck_max_rpcs_in_flight_seq_show(struct seq_file *m, void *data)
659 struct obd_device *dev = m->private;
662 max = obd_get_max_rpcs_in_flight(&dev->u.cli);
663 return seq_printf(m, "%u\n", max);
667 * Change maximum number of RPCs in flight
669 * \param[in] file proc file
670 * \param[in] buffer string which represents maximum number of RPCs in flight
671 * \param[in] count \a buffer length
672 * \param[in] off unused for single entry
673 * \retval \a count on success
674 * \retval negative number on error
677 osp_lfsck_max_rpcs_in_flight_seq_write(struct file *file,
678 const char __user *buffer,
679 size_t count, loff_t *off)
681 struct seq_file *m = file->private_data;
682 struct obd_device *dev = m->private;
686 rc = lprocfs_write_helper(buffer, count, &val);
688 rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val);
695 LPROC_SEQ_FOPS(osp_lfsck_max_rpcs_in_flight);
697 LPROC_SEQ_FOPS_WO_TYPE(osp, ping);
698 LPROC_SEQ_FOPS_RO_TYPE(osp, uuid);
699 LPROC_SEQ_FOPS_RO_TYPE(osp, connect_flags);
700 LPROC_SEQ_FOPS_RO_TYPE(osp, server_uuid);
701 LPROC_SEQ_FOPS_RO_TYPE(osp, conn_uuid);
704 * Show maximum pages per bulk RPC
706 * \param[in] m seq_file handle
707 * \param[in] data unused for single entry
708 * \retval 0 on success
709 * \retval negative number on error
711 static int osp_max_pages_per_rpc_seq_show(struct seq_file *m, void *v)
713 return lprocfs_obd_max_pages_per_rpc_seq_show(m, m->private);
715 LPROC_SEQ_FOPS_RO(osp_max_pages_per_rpc);
716 LPROC_SEQ_FOPS_RO_TYPE(osp, timeouts);
718 LPROC_SEQ_FOPS_RW_TYPE(osp, import);
719 LPROC_SEQ_FOPS_RO_TYPE(osp, state);
721 static struct lprocfs_vars lprocfs_osp_obd_vars[] = {
723 .fops = &osp_uuid_fops },
725 .fops = &osp_ping_fops,
727 { .name = "connect_flags",
728 .fops = &osp_connect_flags_fops },
729 { .name = "ost_server_uuid",
730 .fops = &osp_server_uuid_fops },
731 { .name = "ost_conn_uuid",
732 .fops = &osp_conn_uuid_fops },
734 .fops = &osp_active_fops },
735 { .name = "max_rpcs_in_flight",
736 .fops = &osp_max_rpcs_in_flight_fops },
737 { .name = "max_rpcs_in_progress",
738 .fops = &osp_max_rpcs_in_prog_fops },
739 { .name = "create_count",
740 .fops = &osp_create_count_fops },
741 { .name = "max_create_count",
742 .fops = &osp_max_create_count_fops },
743 { .name = "prealloc_next_id",
744 .fops = &osp_prealloc_next_id_fops },
745 { .name = "prealloc_next_seq",
746 .fops = &osp_prealloc_next_seq_fops },
747 { .name = "prealloc_last_id",
748 .fops = &osp_prealloc_last_id_fops },
749 { .name = "prealloc_last_seq",
750 .fops = &osp_prealloc_last_seq_fops },
751 { .name = "prealloc_reserved",
752 .fops = &osp_prealloc_reserved_fops },
753 { .name = "timeouts",
754 .fops = &osp_timeouts_fops },
756 .fops = &osp_import_fops },
758 .fops = &osp_state_fops },
760 .fops = &osp_maxage_fops },
761 { .name = "prealloc_status",
762 .fops = &osp_pre_status_fops },
763 { .name = "sync_changes",
764 .fops = &osp_syn_changes_fops },
765 { .name = "sync_in_flight",
766 .fops = &osp_syn_in_flight_fops },
767 { .name = "sync_in_progress",
768 .fops = &osp_syn_in_prog_fops },
769 { .name = "old_sync_processed",
770 .fops = &osp_old_sync_processed_fops },
772 /* for compatibility reasons */
773 { .name = "destroys_in_flight",
774 .fops = &osp_destroys_in_flight_fops },
775 { .name = "lfsck_max_rpcs_in_flight",
776 .fops = &osp_lfsck_max_rpcs_in_flight_fops },
780 static struct lprocfs_vars lprocfs_osp_md_vars[] = {
782 .fops = &osp_uuid_fops },
784 .fops = &osp_ping_fops,
786 { .name = "connect_flags",
787 .fops = &osp_connect_flags_fops },
788 { .name = "mdt_server_uuid",
789 .fops = &osp_server_uuid_fops },
790 { .name = "mdt_conn_uuid",
791 .fops = &osp_conn_uuid_fops },
793 .fops = &osp_active_fops },
794 { .name = "max_rpcs_in_flight",
795 .fops = &osp_max_rpcs_in_flight_fops },
796 { .name = "max_rpcs_in_progress",
797 .fops = &osp_max_rpcs_in_prog_fops },
798 { .name = "timeouts",
799 .fops = &osp_timeouts_fops },
801 .fops = &osp_import_fops },
803 .fops = &osp_state_fops },
805 .fops = &osp_maxage_fops },
806 { .name = "prealloc_status",
807 .fops = &osp_pre_status_fops },
809 /* for compatibility reasons */
810 { .name = "destroys_in_flight",
811 .fops = &osp_destroys_in_flight_fops },
812 { .name = "lfsck_max_rpcs_in_flight",
813 .fops = &osp_lfsck_max_rpcs_in_flight_fops },
817 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_blksize);
818 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytestotal);
819 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytesfree);
820 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytesavail);
821 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_filestotal);
822 LPROC_SEQ_FOPS_RO_TYPE(osp, dt_filesfree);
824 static struct lprocfs_vars lprocfs_osp_osd_vars[] = {
825 { .name = "blocksize",
826 .fops = &osp_dt_blksize_fops },
827 { .name = "kbytestotal",
828 .fops = &osp_dt_kbytestotal_fops },
829 { .name = "kbytesfree",
830 .fops = &osp_dt_kbytesfree_fops },
831 { .name = "kbytesavail",
832 .fops = &osp_dt_kbytesavail_fops },
833 { .name = "filestotal",
834 .fops = &osp_dt_filestotal_fops },
835 { .name = "filesfree",
836 .fops = &osp_dt_filesfree_fops },
841 * Initialize OSP lprocfs
843 * param[in] osp OSP device
845 void osp_lprocfs_init(struct osp_device *osp)
847 struct obd_device *obd = osp->opd_obd;
848 struct proc_dir_entry *osc_proc_dir = NULL;
849 struct obd_type *type;
852 if (osp->opd_connect_mdt)
853 obd->obd_vars = lprocfs_osp_md_vars;
855 obd->obd_vars = lprocfs_osp_obd_vars;
856 if (lprocfs_obd_setup(obd) != 0)
859 rc = lprocfs_add_vars(obd->obd_proc_entry, lprocfs_osp_osd_vars,
862 CERROR("%s: can't register in lprocfs, rc %d\n",
867 sptlrpc_lprocfs_cliobd_attach(obd);
868 ptlrpc_lprocfs_register_obd(obd);
870 if (osp->opd_connect_mdt || !strstr(obd->obd_name, "osc"))
873 /* If the real OSC is present which is the case for setups
874 * with both server and clients on the same node then use
875 * the OSC's proc root */
876 type = class_search_type(LUSTRE_OSC_NAME);
877 if (type != NULL && type->typ_procroot != NULL)
878 osc_proc_dir = type->typ_procroot;
880 osc_proc_dir = obd->obd_type->typ_procsym;
882 if (osc_proc_dir == NULL)
885 /* for compatibility we link old procfs's OSC entries to osp ones */
886 osp->opd_symlink = lprocfs_add_symlink(obd->obd_name, osc_proc_dir,
887 "../osp/%s", obd->obd_name);
888 if (osp->opd_symlink == NULL)
889 CERROR("cannot create OSC symlink for /proc/fs/lustre/osp/%s\n",
893 #endif /* CONFIG_PROC_FS */