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) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2014, 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/obdclass/lprocfs_status_server.c
35 #define DEBUG_SUBSYSTEM S_CLASS
37 #include <linux/kobject.h>
38 #include <linux/sysfs.h>
40 #include <obd_class.h>
41 #include <lprocfs_status.h>
42 #include <lustre_nodemap.h>
44 #define MAX_STRING_SIZE 128
46 struct dentry *ldebugfs_add_symlink(const char *name, const char *target,
47 const char *format, ...)
49 struct dentry *entry = NULL;
50 struct dentry *parent;
55 if (!target || !format)
59 dname.len = strlen(dname.name);
60 dname.hash = ll_full_name_hash(debugfs_lustre_root,
61 dname.name, dname.len);
62 parent = d_lookup(debugfs_lustre_root, &dname);
66 OBD_ALLOC_WAIT(dest, MAX_STRING_SIZE + 1);
71 vsnprintf(dest, MAX_STRING_SIZE, format, ap);
74 entry = debugfs_create_symlink(name, parent, dest);
75 if (IS_ERR_OR_NULL(entry)) {
76 CERROR("LdebugFS: Could not create symbolic link from %s to %s\n",
81 OBD_FREE(dest, MAX_STRING_SIZE + 1);
86 EXPORT_SYMBOL(ldebugfs_add_symlink);
90 int lprocfs_evict_client_open(struct inode *inode, struct file *f)
92 struct obd_device *obd = PDE_DATA(file_inode(f));
94 atomic_inc(&obd->obd_evict_inprogress);
98 int lprocfs_evict_client_release(struct inode *inode, struct file *f)
100 struct obd_device *obd = PDE_DATA(file_inode(f));
102 atomic_dec(&obd->obd_evict_inprogress);
103 wake_up(&obd->obd_evict_inprogress_waitq);
108 #define BUFLEN (UUID_MAX + 5)
111 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
112 size_t count, loff_t *off)
114 struct seq_file *m = file->private_data;
115 struct obd_device *obd = m->private;
118 OBD_ALLOC(kbuf, BUFLEN);
123 * OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
124 * bytes into kbuf, to ensure that the string is NUL-terminated.
125 * UUID_MAX should include a trailing NUL already.
127 if (copy_from_user(kbuf, buffer,
128 min_t(unsigned long, BUFLEN - 1, count))) {
132 tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count));
133 class_incref(obd, __func__, current);
135 if (strncmp(tmpbuf, "nid:", 4) == 0)
136 obd_export_evict_by_nid(obd, tmpbuf + 4);
137 else if (strncmp(tmpbuf, "uuid:", 5) == 0)
138 obd_export_evict_by_uuid(obd, tmpbuf + 5);
140 obd_export_evict_by_uuid(obd, tmpbuf);
142 class_decref(obd, __func__, current);
145 OBD_FREE(kbuf, BUFLEN);
148 EXPORT_SYMBOL(lprocfs_evict_client_seq_write);
152 ssize_t num_exports_show(struct kobject *kobj, struct attribute *attr,
155 struct obd_device *obd = container_of(kobj, struct obd_device,
158 return scnprintf(buf, PAGE_SIZE, "%u\n", obd->obd_num_exports);
160 EXPORT_SYMBOL(num_exports_show);
162 static int obd_export_flags2str(struct obd_export *exp, struct seq_file *m)
166 flag2str(exp, failed);
167 flag2str(exp, in_recovery);
168 flag2str(exp, disconnected);
169 flag2str(exp, connecting);
175 lprocfs_exp_print_export_seq(struct cfs_hash *hs, struct cfs_hash_bd *bd,
176 struct hlist_node *hnode, void *cb_data)
178 struct seq_file *m = cb_data;
179 struct obd_export *exp = cfs_hash_object(hs, hnode);
180 struct obd_device *obd;
181 struct obd_connect_data *ocd;
183 LASSERT(exp != NULL);
184 if (exp->exp_nid_stats == NULL)
187 ocd = &exp->exp_connect_data;
189 seq_printf(m, "%s:\n"
192 " connect_flags: [ ",
193 obd_uuid2str(&exp->exp_client_uuid),
195 obd_export_nid2str(exp));
196 obd_connect_seq_flags2str(m, ocd->ocd_connect_flags,
197 ocd->ocd_connect_flags2, ", ");
198 seq_printf(m, " ]\n");
199 obd_connect_data_seqprint(m, ocd);
200 seq_printf(m, " export_flags: [ ");
201 obd_export_flags2str(exp, m);
202 seq_printf(m, " ]\n");
209 * RPC connections are composed of an import and an export. Using the
210 * lctl utility we can extract important information about the state.
211 * The lprocfs_exp_export_seq_show routine displays the state information
214 * \param[in] m seq file
215 * \param[in] data unused
217 * \retval 0 on success
219 * The format of the export state information is like:
220 * a793e354-49c0-aa11-8c4f-a4f2b1a1a92b:
222 * client: 10.211.55.10@tcp
223 * connect_flags: [ version, barrier, adaptive_timeouts, ... ]
225 * flags: 0x2000011005002020
227 * target_version: 2.10.51.0
228 * export_flags: [ ... ]
231 static int lprocfs_exp_export_seq_show(struct seq_file *m, void *data)
233 struct nid_stat *stats = m->private;
234 struct obd_device *obd = stats->nid_obd;
236 cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
237 lprocfs_exp_print_export_seq, m);
240 LPROC_SEQ_FOPS_RO(lprocfs_exp_export);
242 static void lprocfs_free_client_stats(struct nid_stat *client_stat)
244 CDEBUG(D_CONFIG, "stat %p - data %p/%p\n", client_stat,
245 client_stat->nid_proc, client_stat->nid_stats);
247 LASSERTF(atomic_read(&client_stat->nid_exp_ref_count) == 0,
248 "nid %s:count %d\n", libcfs_nid2str(client_stat->nid),
249 atomic_read(&client_stat->nid_exp_ref_count));
251 if (client_stat->nid_proc)
252 lprocfs_remove(&client_stat->nid_proc);
254 if (client_stat->nid_stats)
255 lprocfs_free_stats(&client_stat->nid_stats);
257 if (client_stat->nid_ldlm_stats)
258 lprocfs_free_stats(&client_stat->nid_ldlm_stats);
260 OBD_FREE_PTR(client_stat);
263 void lprocfs_free_per_client_stats(struct obd_device *obd)
265 struct cfs_hash *hash = obd->obd_nid_stats_hash;
266 struct nid_stat *stat;
269 /* we need extra list - because hash_exit called to early */
270 /* not need locking because all clients is died */
271 while (!list_empty(&obd->obd_nid_stats)) {
272 stat = list_entry(obd->obd_nid_stats.next,
273 struct nid_stat, nid_list);
274 list_del_init(&stat->nid_list);
275 cfs_hash_del(hash, &stat->nid, &stat->nid_hash);
276 lprocfs_free_client_stats(stat);
280 EXPORT_SYMBOL(lprocfs_free_per_client_stats);
283 lprocfs_exp_print_uuid_seq(struct cfs_hash *hs, struct cfs_hash_bd *bd,
284 struct hlist_node *hnode, void *cb_data)
286 struct seq_file *m = cb_data;
287 struct obd_export *exp = cfs_hash_object(hs, hnode);
289 if (exp->exp_nid_stats != NULL)
290 seq_printf(m, "%s\n", obd_uuid2str(&exp->exp_client_uuid));
295 lprocfs_exp_print_nodemap_seq(struct cfs_hash *hs, struct cfs_hash_bd *bd,
296 struct hlist_node *hnode, void *cb_data)
298 struct seq_file *m = cb_data;
299 struct obd_export *exp = cfs_hash_object(hs, hnode);
300 struct lu_nodemap *nodemap = exp->exp_target_data.ted_nodemap;
303 seq_printf(m, "%s\n", nodemap->nm_name);
308 lprocfs_exp_nodemap_seq_show(struct seq_file *m, void *data)
310 struct nid_stat *stats = m->private;
311 struct obd_device *obd = stats->nid_obd;
313 cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
314 lprocfs_exp_print_nodemap_seq, m);
317 LPROC_SEQ_FOPS_RO(lprocfs_exp_nodemap);
319 static int lprocfs_exp_uuid_seq_show(struct seq_file *m, void *data)
321 struct nid_stat *stats = m->private;
322 struct obd_device *obd = stats->nid_obd;
324 cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
325 lprocfs_exp_print_uuid_seq, m);
328 LPROC_SEQ_FOPS_RO(lprocfs_exp_uuid);
331 lprocfs_exp_print_hash_seq(struct cfs_hash *hs, struct cfs_hash_bd *bd,
332 struct hlist_node *hnode, void *cb_data)
335 struct seq_file *m = cb_data;
336 struct obd_export *exp = cfs_hash_object(hs, hnode);
338 if (exp->exp_lock_hash != NULL) {
339 cfs_hash_debug_header(m);
340 cfs_hash_debug_str(hs, m);
345 static int lprocfs_exp_hash_seq_show(struct seq_file *m, void *data)
347 struct nid_stat *stats = m->private;
348 struct obd_device *obd = stats->nid_obd;
350 cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
351 lprocfs_exp_print_hash_seq, m);
354 LPROC_SEQ_FOPS_RO(lprocfs_exp_hash);
356 int lprocfs_exp_print_replydata_seq(struct cfs_hash *hs, struct cfs_hash_bd *bd,
357 struct hlist_node *hnode, void *cb_data)
360 struct obd_export *exp = cfs_hash_object(hs, hnode);
361 struct seq_file *m = cb_data;
362 struct tg_export_data *ted = &exp->exp_target_data;
364 seq_printf(m, "reply_cnt: %d\n"
366 "reply_released_by_xid: %d\n"
367 "reply_released_by_tag: %d\n\n",
370 ted->ted_release_xid,
371 ted->ted_release_tag);
375 int lprocfs_exp_replydata_seq_show(struct seq_file *m, void *data)
377 struct nid_stat *stats = m->private;
378 struct obd_device *obd = stats->nid_obd;
380 cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
381 lprocfs_exp_print_replydata_seq, m);
384 LPROC_SEQ_FOPS_RO(lprocfs_exp_replydata);
386 int lprocfs_exp_print_fmd_count_seq(struct cfs_hash *hs, struct cfs_hash_bd *bd,
387 struct hlist_node *hnode, void *cb_data)
390 struct obd_export *exp = cfs_hash_object(hs, hnode);
391 struct seq_file *m = cb_data;
392 struct tg_export_data *ted = &exp->exp_target_data;
394 seq_printf(m, "%d\n", ted->ted_fmd_count);
399 int lprocfs_exp_fmd_count_seq_show(struct seq_file *m, void *data)
401 struct nid_stat *stats = m->private;
402 struct obd_device *obd = stats->nid_obd;
404 cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
405 lprocfs_exp_print_fmd_count_seq, m);
408 LPROC_SEQ_FOPS_RO(lprocfs_exp_fmd_count);
410 int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
412 seq_puts(m, "Write into this file to clear all nid stats and stale nid entries\n");
415 EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_show);
417 static int lprocfs_nid_stats_clear_write_cb(void *obj, void *data)
419 struct nid_stat *stat = obj;
422 CDEBUG(D_INFO, "refcnt %d\n", atomic_read(&stat->nid_exp_ref_count));
423 if (atomic_read(&stat->nid_exp_ref_count) == 1) {
424 /* object has only hash references. */
425 spin_lock(&stat->nid_obd->obd_nid_lock);
426 list_move(&stat->nid_list, data);
427 spin_unlock(&stat->nid_obd->obd_nid_lock);
430 /* we has reference to object - only clear data*/
432 lprocfs_clear_stats(stat->nid_stats);
438 lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
439 size_t count, loff_t *off)
441 struct seq_file *m = file->private_data;
442 struct obd_device *obd = m->private;
443 struct nid_stat *client_stat;
444 struct list_head free_list;
446 INIT_LIST_HEAD(&free_list);
447 cfs_hash_cond_del(obd->obd_nid_stats_hash,
448 lprocfs_nid_stats_clear_write_cb, &free_list);
450 while (!list_empty(&free_list)) {
451 client_stat = list_entry(free_list.next, struct nid_stat,
453 list_del_init(&client_stat->nid_list);
454 lprocfs_free_client_stats(client_stat);
458 EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_write);
460 int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid)
462 struct nid_stat *new_stat, *old_stat;
463 struct obd_device *obd = NULL;
464 struct proc_dir_entry *entry;
465 char nidstr[LNET_NIDSTR_SIZE];
469 if (!exp || !exp->exp_obd || !exp->exp_obd->obd_proc_exports_entry ||
470 !exp->exp_obd->obd_nid_stats_hash)
473 /* not test against zero because eric say:
474 * You may only test nid against another nid, or LNET_NID_ANY.
475 * Anything else is nonsense.*/
476 if (nid == NULL || *nid == LNET_NID_ANY)
479 libcfs_nid2str_r(*nid, nidstr, sizeof(nidstr));
481 spin_lock(&exp->exp_lock);
482 if (exp->exp_nid_stats != NULL) {
483 spin_unlock(&exp->exp_lock);
486 spin_unlock(&exp->exp_lock);
490 CDEBUG(D_CONFIG, "using hash %p\n", obd->obd_nid_stats_hash);
492 OBD_ALLOC_PTR(new_stat);
493 if (new_stat == NULL)
496 new_stat->nid = *nid;
497 new_stat->nid_obd = exp->exp_obd;
498 /* we need set default refcount to 1 to balance obd_disconnect */
499 atomic_set(&new_stat->nid_exp_ref_count, 1);
501 old_stat = cfs_hash_findadd_unique(obd->obd_nid_stats_hash,
502 nid, &new_stat->nid_hash);
503 CDEBUG(D_INFO, "Found stats %p for nid %s - ref %d\n",
504 old_stat, nidstr, atomic_read(&old_stat->nid_exp_ref_count));
506 /* Return -EALREADY here so that we know that the /proc
507 * entry already has been created */
508 if (old_stat != new_stat) {
509 spin_lock(&exp->exp_lock);
510 if (exp->exp_nid_stats) {
511 LASSERT(exp->exp_nid_stats == old_stat);
512 nidstat_putref(exp->exp_nid_stats);
514 exp->exp_nid_stats = old_stat;
515 spin_unlock(&exp->exp_lock);
516 GOTO(destroy_new, rc = -EALREADY);
518 /* not found - create */
519 new_stat->nid_proc = lprocfs_register(nidstr,
520 obd->obd_proc_exports_entry,
523 if (IS_ERR(new_stat->nid_proc)) {
524 rc = PTR_ERR(new_stat->nid_proc);
525 new_stat->nid_proc = NULL;
526 CERROR("%s: cannot create proc entry for export %s: rc = %d\n",
527 obd->obd_name, nidstr, rc);
528 GOTO(destroy_new_ns, rc);
531 entry = lprocfs_add_simple(new_stat->nid_proc, "nodemap", new_stat,
532 &lprocfs_exp_nodemap_fops);
535 CWARN("%s: error adding the nodemap file: rc = %d\n",
537 GOTO(destroy_new_ns, rc);
540 entry = lprocfs_add_simple(new_stat->nid_proc, "uuid", new_stat,
541 &lprocfs_exp_uuid_fops);
544 CWARN("%s: error adding the NID stats file: rc = %d\n",
546 GOTO(destroy_new_ns, rc);
549 entry = lprocfs_add_simple(new_stat->nid_proc, "hash", new_stat,
550 &lprocfs_exp_hash_fops);
553 CWARN("%s: error adding the hash file: rc = %d\n",
555 GOTO(destroy_new_ns, rc);
558 entry = lprocfs_add_simple(new_stat->nid_proc, "export",
559 new_stat, &lprocfs_exp_export_fops);
562 CWARN("%s: error adding the export file: rc = %d\n",
564 GOTO(destroy_new_ns, rc);
567 entry = lprocfs_add_simple(new_stat->nid_proc, "reply_data", new_stat,
568 &lprocfs_exp_replydata_fops);
571 CWARN("%s: error adding the reply_data file: rc = %d\n",
573 GOTO(destroy_new_ns, rc);
576 entry = lprocfs_add_simple(new_stat->nid_proc, "fmd_count", new_stat,
577 &lprocfs_exp_fmd_count_fops);
580 CWARN("%s: error adding the fmd_count file: rc = %d\n",
582 GOTO(destroy_new_ns, rc);
585 spin_lock(&exp->exp_lock);
586 exp->exp_nid_stats = new_stat;
587 spin_unlock(&exp->exp_lock);
589 /* protect competitive add to list, not need locking on destroy */
590 spin_lock(&obd->obd_nid_lock);
591 list_add(&new_stat->nid_list, &obd->obd_nid_stats);
592 spin_unlock(&obd->obd_nid_lock);
597 if (new_stat->nid_proc != NULL)
598 lprocfs_remove(&new_stat->nid_proc);
599 cfs_hash_del(obd->obd_nid_stats_hash, nid, &new_stat->nid_hash);
602 nidstat_putref(new_stat);
603 OBD_FREE_PTR(new_stat);
606 EXPORT_SYMBOL(lprocfs_exp_setup);
608 int lprocfs_exp_cleanup(struct obd_export *exp)
610 struct nid_stat *stat = exp->exp_nid_stats;
612 if (!stat || !exp->exp_obd)
615 nidstat_putref(exp->exp_nid_stats);
616 exp->exp_nid_stats = NULL;
621 int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned int num_stats)
623 struct lprocfs_stats *stats;
626 LASSERT(obd->obd_stats == NULL);
627 LASSERT(obd->obd_proc_entry != NULL);
629 stats = lprocfs_alloc_stats(num_stats, 0);
633 rc = lprocfs_register_stats(obd->obd_proc_entry, "stats", stats);
635 lprocfs_free_stats(&stats);
637 obd->obd_stats = stats;
641 EXPORT_SYMBOL(lprocfs_alloc_obd_stats);
643 void lprocfs_free_obd_stats(struct obd_device *obd)
646 lprocfs_free_stats(&obd->obd_stats);
648 EXPORT_SYMBOL(lprocfs_free_obd_stats);
650 int lprocfs_hash_seq_show(struct seq_file *m, void *data)
652 struct obd_device *obd = m->private;
657 cfs_hash_debug_header(m);
658 cfs_hash_debug_str(obd->obd_uuid_hash, m);
659 cfs_hash_debug_str(obd->obd_nid_hash, m);
660 cfs_hash_debug_str(obd->obd_nid_stats_hash, m);
663 EXPORT_SYMBOL(lprocfs_hash_seq_show);
665 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data)
667 struct obd_device *obd = m->private;
668 struct target_distribute_txn_data *tdtd;
670 LASSERT(obd != NULL);
672 seq_printf(m, "status: ");
673 if (atomic_read(&obd->obd_max_recoverable_clients) == 0) {
674 seq_printf(m, "INACTIVE\n");
678 /* sampled unlocked, but really... */
679 if (obd->obd_recovering == 0) {
680 seq_printf(m, "COMPLETE\n");
681 seq_printf(m, "recovery_start: %lld\n",
682 (s64)obd->obd_recovery_start);
683 seq_printf(m, "recovery_duration: %lld\n",
684 obd->obd_recovery_end ?
685 obd->obd_recovery_end - obd->obd_recovery_start :
686 ktime_get_real_seconds() - obd->obd_recovery_start);
687 /* Number of clients that have completed recovery */
688 seq_printf(m, "completed_clients: %d/%d\n",
689 atomic_read(&obd->obd_max_recoverable_clients) -
690 obd->obd_stale_clients,
691 atomic_read(&obd->obd_max_recoverable_clients));
692 seq_printf(m, "replayed_requests: %d\n",
693 obd->obd_replayed_requests);
694 seq_printf(m, "last_transno: %lld\n",
695 obd->obd_next_recovery_transno - 1);
696 seq_printf(m, "VBR: %s\n", obd->obd_version_recov ?
697 "ENABLED" : "DISABLED");
698 seq_printf(m, "IR: %s\n", obd->obd_no_ir ?
699 "DISABLED" : "ENABLED");
703 tdtd = obd->u.obt.obt_lut->lut_tdtd;
704 if (tdtd && tdtd->tdtd_show_update_logs_retrievers) {
709 buf = tdtd->tdtd_show_update_logs_retrievers(
710 tdtd->tdtd_show_retrievers_cbdata,
713 seq_printf(m, "WAITING\n");
714 seq_printf(m, "non-ready MDTs: %s\n",
715 buf ? buf : "unknown (not enough RAM)");
716 seq_printf(m, "recovery_start: %lld\n",
717 (s64)obd->obd_recovery_start);
718 seq_printf(m, "time_waited: %lld\n",
719 (s64)(ktime_get_real_seconds() -
720 obd->obd_recovery_start));
726 if (likely(count > 0))
730 /* recovery won't start until the clients connect */
731 if (obd->obd_recovery_start == 0) {
732 seq_printf(m, "WAITING_FOR_CLIENTS\n");
736 seq_printf(m, "RECOVERING\n");
737 seq_printf(m, "recovery_start: %lld\n", (s64)obd->obd_recovery_start);
738 seq_printf(m, "time_remaining: %lld\n",
739 ktime_get_real_seconds() >=
740 obd->obd_recovery_start +
741 obd->obd_recovery_timeout ? 0 :
742 (s64)(obd->obd_recovery_start +
743 obd->obd_recovery_timeout -
744 ktime_get_real_seconds()));
745 seq_printf(m, "connected_clients: %d/%d\n",
746 atomic_read(&obd->obd_connected_clients),
747 atomic_read(&obd->obd_max_recoverable_clients));
748 /* Number of clients that have completed recovery */
749 seq_printf(m, "req_replay_clients: %d\n",
750 atomic_read(&obd->obd_req_replay_clients));
751 seq_printf(m, "lock_repay_clients: %d\n",
752 atomic_read(&obd->obd_lock_replay_clients));
753 seq_printf(m, "completed_clients: %d\n",
754 atomic_read(&obd->obd_connected_clients) -
755 atomic_read(&obd->obd_lock_replay_clients));
756 seq_printf(m, "evicted_clients: %d\n", obd->obd_stale_clients);
757 seq_printf(m, "replayed_requests: %d\n", obd->obd_replayed_requests);
758 seq_printf(m, "queued_requests: %d\n",
759 obd->obd_requests_queued_for_recovery);
760 seq_printf(m, "next_transno: %lld\n",
761 obd->obd_next_recovery_transno);
765 EXPORT_SYMBOL(lprocfs_recovery_status_seq_show);
767 ssize_t ir_factor_show(struct kobject *kobj, struct attribute *attr,
770 struct obd_device *obd = container_of(kobj, struct obd_device,
773 return scnprintf(buf, PAGE_SIZE, "%d\n", obd->obd_recovery_ir_factor);
775 EXPORT_SYMBOL(ir_factor_show);
777 ssize_t ir_factor_store(struct kobject *kobj, struct attribute *attr,
778 const char *buffer, size_t count)
780 struct obd_device *obd = container_of(kobj, struct obd_device,
785 rc = kstrtoint(buffer, 10, &val);
789 if (val < OBD_IR_FACTOR_MIN || val > OBD_IR_FACTOR_MAX)
792 obd->obd_recovery_ir_factor = val;
795 EXPORT_SYMBOL(ir_factor_store);
797 int lprocfs_checksum_dump_seq_show(struct seq_file *m, void *data)
799 struct obd_device *obd = m->private;
801 LASSERT(obd != NULL);
802 seq_printf(m, "%d\n", obd->obd_checksum_dump);
805 EXPORT_SYMBOL(lprocfs_checksum_dump_seq_show);
808 lprocfs_checksum_dump_seq_write(struct file *file, const char __user *buffer,
809 size_t count, loff_t *off)
811 struct seq_file *m = file->private_data;
812 struct obd_device *obd = m->private;
816 LASSERT(obd != NULL);
817 rc = kstrtobool_from_user(buffer, count, &val);
821 obd->obd_checksum_dump = val;
824 EXPORT_SYMBOL(lprocfs_checksum_dump_seq_write);
826 ssize_t recovery_time_soft_show(struct kobject *kobj, struct attribute *attr,
829 struct obd_device *obd = container_of(kobj, struct obd_device,
832 return scnprintf(buf, PAGE_SIZE, "%ld\n", obd->obd_recovery_timeout);
834 EXPORT_SYMBOL(recovery_time_soft_show);
836 ssize_t recovery_time_soft_store(struct kobject *kobj,
837 struct attribute *attr,
838 const char *buffer, size_t count)
840 struct obd_device *obd = container_of(kobj, struct obd_device,
845 rc = kstrtouint(buffer, 0, &val);
849 obd->obd_recovery_timeout = val;
852 EXPORT_SYMBOL(recovery_time_soft_store);
854 ssize_t recovery_time_hard_show(struct kobject *kobj, struct attribute *attr,
857 struct obd_device *obd = container_of(kobj, struct obd_device,
860 return scnprintf(buf, PAGE_SIZE, "%ld\n", obd->obd_recovery_time_hard);
862 EXPORT_SYMBOL(recovery_time_hard_show);
864 ssize_t recovery_time_hard_store(struct kobject *kobj,
865 struct attribute *attr,
866 const char *buffer, size_t count)
868 struct obd_device *obd = container_of(kobj, struct obd_device,
873 rc = kstrtouint(buffer, 0, &val);
877 obd->obd_recovery_time_hard = val;
880 EXPORT_SYMBOL(recovery_time_hard_store);
882 ssize_t instance_show(struct kobject *kobj, struct attribute *attr,
885 struct obd_device *obd = container_of(kobj, struct obd_device,
887 struct obd_device_target *target = &obd->u.obt;
889 LASSERT(target->obt_magic == OBT_MAGIC);
890 return scnprintf(buf, PAGE_SIZE, "%u\n", obd->u.obt.obt_instance);
892 EXPORT_SYMBOL(instance_show);
894 #endif /* CONFIG_PROC_FS*/