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);
76 OBD_FREE(dest, MAX_STRING_SIZE + 1);
81 EXPORT_SYMBOL(ldebugfs_add_symlink);
85 int lprocfs_evict_client_open(struct inode *inode, struct file *f)
87 struct obd_device *obd = PDE_DATA(file_inode(f));
89 atomic_inc(&obd->obd_evict_inprogress);
93 int lprocfs_evict_client_release(struct inode *inode, struct file *f)
95 struct obd_device *obd = PDE_DATA(file_inode(f));
97 atomic_dec(&obd->obd_evict_inprogress);
98 wake_up(&obd->obd_evict_inprogress_waitq);
103 #define BUFLEN (UUID_MAX + 5)
106 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
107 size_t count, loff_t *off)
109 struct seq_file *m = file->private_data;
110 struct obd_device *obd = m->private;
113 OBD_ALLOC(kbuf, BUFLEN);
118 * OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
119 * bytes into kbuf, to ensure that the string is NUL-terminated.
120 * UUID_MAX should include a trailing NUL already.
122 if (copy_from_user(kbuf, buffer,
123 min_t(unsigned long, BUFLEN - 1, count))) {
127 tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count));
128 class_incref(obd, __func__, current);
130 if (strncmp(tmpbuf, "nid:", 4) == 0)
131 obd_export_evict_by_nid(obd, tmpbuf + 4);
132 else if (strncmp(tmpbuf, "uuid:", 5) == 0)
133 obd_export_evict_by_uuid(obd, tmpbuf + 5);
135 obd_export_evict_by_uuid(obd, tmpbuf);
137 class_decref(obd, __func__, current);
140 OBD_FREE(kbuf, BUFLEN);
143 EXPORT_SYMBOL(lprocfs_evict_client_seq_write);
147 ssize_t num_exports_show(struct kobject *kobj, struct attribute *attr,
150 struct obd_device *obd = container_of(kobj, struct obd_device,
153 return scnprintf(buf, PAGE_SIZE, "%u\n", obd->obd_num_exports);
155 EXPORT_SYMBOL(num_exports_show);
157 static int obd_export_flags2str(struct obd_export *exp, struct seq_file *m)
161 flag2str(exp, failed);
162 flag2str(exp, in_recovery);
163 flag2str(exp, disconnected);
164 flag2str(exp, connecting);
165 flag2str(exp, no_recovery);
171 lprocfs_exp_print_export_seq(struct obd_export *exp, void *cb_data)
173 struct seq_file *m = cb_data;
174 struct obd_device *obd;
175 struct obd_connect_data *ocd;
177 LASSERT(exp != NULL);
178 if (exp->exp_nid_stats == NULL)
181 ocd = &exp->exp_connect_data;
183 seq_printf(m, "%s:\n"
186 " connect_flags: [ ",
187 obd_uuid2str(&exp->exp_client_uuid),
189 obd_export_nid2str(exp));
190 obd_connect_seq_flags2str(m, ocd->ocd_connect_flags,
191 ocd->ocd_connect_flags2, ", ");
192 seq_printf(m, " ]\n");
193 obd_connect_data_seqprint(m, ocd);
194 seq_printf(m, " export_flags: [ ");
195 obd_export_flags2str(exp, m);
196 seq_printf(m, " ]\n");
203 * RPC connections are composed of an import and an export. Using the
204 * lctl utility we can extract important information about the state.
205 * The lprocfs_exp_export_seq_show routine displays the state information
208 * \param[in] m seq file
209 * \param[in] data unused
211 * \retval 0 on success
213 * The format of the export state information is like:
214 * a793e354-49c0-aa11-8c4f-a4f2b1a1a92b:
216 * client: 10.211.55.10@tcp
217 * connect_flags: [ version, barrier, adaptive_timeouts, ... ]
219 * flags: 0x2000011005002020
221 * target_version: 2.10.51.0
222 * export_flags: [ ... ]
225 static int lprocfs_exp_export_seq_show(struct seq_file *m, void *data)
227 struct nid_stat *stats = m->private;
229 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
230 lprocfs_exp_print_export_seq, m);
232 LPROC_SEQ_FOPS_RO(lprocfs_exp_export);
234 static void lprocfs_free_client_stats(struct nid_stat *client_stat)
236 CDEBUG(D_CONFIG, "stat %p - data %p/%p\n", client_stat,
237 client_stat->nid_proc, client_stat->nid_stats);
239 LASSERTF(atomic_read(&client_stat->nid_exp_ref_count) == 0,
240 "nid %s:count %d\n", libcfs_nid2str(client_stat->nid),
241 atomic_read(&client_stat->nid_exp_ref_count));
243 if (client_stat->nid_proc)
244 lprocfs_remove(&client_stat->nid_proc);
246 if (client_stat->nid_stats)
247 lprocfs_free_stats(&client_stat->nid_stats);
249 if (client_stat->nid_ldlm_stats)
250 lprocfs_free_stats(&client_stat->nid_ldlm_stats);
252 OBD_FREE_PTR(client_stat);
255 void lprocfs_free_per_client_stats(struct obd_device *obd)
257 struct cfs_hash *hash = obd->obd_nid_stats_hash;
258 struct nid_stat *stat;
261 /* we need extra list - because hash_exit called to early */
262 /* not need locking because all clients is died */
263 while (!list_empty(&obd->obd_nid_stats)) {
264 stat = list_entry(obd->obd_nid_stats.next,
265 struct nid_stat, nid_list);
266 list_del_init(&stat->nid_list);
267 cfs_hash_del(hash, &stat->nid, &stat->nid_hash);
268 lprocfs_free_client_stats(stat);
272 EXPORT_SYMBOL(lprocfs_free_per_client_stats);
275 lprocfs_exp_print_nodemap_seq(struct obd_export *exp, void *cb_data)
277 struct lu_nodemap *nodemap = exp->exp_target_data.ted_nodemap;
278 struct seq_file *m = cb_data;
281 seq_printf(m, "%s\n", nodemap->nm_name);
286 lprocfs_exp_nodemap_seq_show(struct seq_file *m, void *data)
288 struct nid_stat *stats = m->private;
290 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
291 lprocfs_exp_print_nodemap_seq, m);
293 LPROC_SEQ_FOPS_RO(lprocfs_exp_nodemap);
296 lprocfs_exp_print_uuid_seq(struct obd_export *exp, void *cb_data)
298 struct seq_file *m = cb_data;
300 if (exp->exp_nid_stats)
301 seq_printf(m, "%s\n", obd_uuid2str(&exp->exp_client_uuid));
305 static int lprocfs_exp_uuid_seq_show(struct seq_file *m, void *data)
307 struct nid_stat *stats = m->private;
309 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
310 lprocfs_exp_print_uuid_seq, m);
312 LPROC_SEQ_FOPS_RO(lprocfs_exp_uuid);
314 #define HASH_NAME_LEN 16
316 static void ldebugfs_rhash_seq_show(const char *name, struct rhashtable *ht,
319 unsigned int max_size = ht->p.max_size ? ht->p.max_size : UINT_MAX;
320 struct bucket_table *tbl;
321 int dist[8] = { 0, };
326 tbl = rht_dereference(ht->tbl, ht);
327 for (i = 0; i < tbl->size; i++) {
328 struct rhash_head *pos;
331 rht_for_each(pos, tbl, i)
335 maxdep = max(maxdep, count);
337 dist[min(fls(count), 7)]++;
340 seq_printf(m, "%-*s %5d %5d %10u %d.%03d 0.300 0.750 0x%03x %7d %7d %7d ",
341 HASH_NAME_LEN, name, tbl->size, ht->p.min_size, max_size,
342 atomic_read(&ht->nelems) / tbl->size,
343 atomic_read(&ht->nelems) * 1000 / tbl->size,
344 ht->p.automatic_shrinking, 0,
345 atomic_read(&ht->nelems), maxdep);
348 for (i = 0; i < 8; i++)
349 seq_printf(m, "%d%c", dist[i], (i == 7) ? '\n' : '/');
353 lprocfs_exp_print_hash_seq(struct obd_export *exp, void *cb_data)
356 struct obd_device *obd = exp->exp_obd;
357 struct seq_file *m = cb_data;
359 if (exp->exp_lock_hash != NULL) {
360 seq_printf(m, "%-*s cur min max theta t-min t-max flags rehash count distribution\n",
361 HASH_NAME_LEN, "name");
362 ldebugfs_rhash_seq_show("NID_HASH", &obd->obd_nid_hash.ht, m);
367 static int lprocfs_exp_hash_seq_show(struct seq_file *m, void *data)
369 struct nid_stat *stats = m->private;
371 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
372 lprocfs_exp_print_hash_seq, m);
374 LPROC_SEQ_FOPS_RO(lprocfs_exp_hash);
376 int lprocfs_exp_print_replydata_seq(struct obd_export *exp, void *cb_data)
379 struct seq_file *m = cb_data;
380 struct tg_export_data *ted = &exp->exp_target_data;
382 seq_printf(m, "reply_cnt: %d\n"
384 "reply_released_by_xid: %d\n"
385 "reply_released_by_tag: %d\n\n",
388 ted->ted_release_xid,
389 ted->ted_release_tag);
393 int lprocfs_exp_replydata_seq_show(struct seq_file *m, void *data)
395 struct nid_stat *stats = m->private;
397 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
398 lprocfs_exp_print_replydata_seq, m);
400 LPROC_SEQ_FOPS_RO(lprocfs_exp_replydata);
402 int lprocfs_exp_print_fmd_count_seq(struct obd_export *exp, void *cb_data)
404 struct seq_file *m = cb_data;
405 struct tg_export_data *ted = &exp->exp_target_data;
407 seq_printf(m, "%d\n", ted->ted_fmd_count);
412 int lprocfs_exp_fmd_count_seq_show(struct seq_file *m, void *data)
414 struct nid_stat *stats = m->private;
416 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
417 lprocfs_exp_print_fmd_count_seq, m);
419 LPROC_SEQ_FOPS_RO(lprocfs_exp_fmd_count);
421 int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
423 seq_puts(m, "Write into this file to clear all nid stats and stale nid entries\n");
426 EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_show);
428 static int lprocfs_nid_stats_clear_write_cb(void *obj, void *data)
430 struct nid_stat *stat = obj;
433 CDEBUG(D_INFO, "refcnt %d\n", atomic_read(&stat->nid_exp_ref_count));
434 if (atomic_read(&stat->nid_exp_ref_count) == 1) {
435 /* object has only hash references. */
436 spin_lock(&stat->nid_obd->obd_nid_lock);
437 list_move(&stat->nid_list, data);
438 spin_unlock(&stat->nid_obd->obd_nid_lock);
441 /* we has reference to object - only clear data*/
443 lprocfs_clear_stats(stat->nid_stats);
449 lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
450 size_t count, loff_t *off)
452 struct seq_file *m = file->private_data;
453 struct obd_device *obd = m->private;
454 struct nid_stat *client_stat;
455 LIST_HEAD(free_list);
457 cfs_hash_cond_del(obd->obd_nid_stats_hash,
458 lprocfs_nid_stats_clear_write_cb, &free_list);
460 while (!list_empty(&free_list)) {
461 client_stat = list_entry(free_list.next, struct nid_stat,
463 list_del_init(&client_stat->nid_list);
464 lprocfs_free_client_stats(client_stat);
468 EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_write);
470 int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid)
472 struct nid_stat *new_stat, *old_stat;
473 struct obd_device *obd = NULL;
474 struct proc_dir_entry *entry;
475 char nidstr[LNET_NIDSTR_SIZE];
479 if (!exp || !exp->exp_obd || !exp->exp_obd->obd_proc_exports_entry ||
480 !exp->exp_obd->obd_nid_stats_hash)
483 /* not test against zero because eric say:
484 * You may only test nid against another nid, or LNET_NID_ANY.
485 * Anything else is nonsense.*/
486 if (nid == NULL || *nid == LNET_NID_ANY)
489 libcfs_nid2str_r(*nid, nidstr, sizeof(nidstr));
491 spin_lock(&exp->exp_lock);
492 if (exp->exp_nid_stats != NULL) {
493 spin_unlock(&exp->exp_lock);
496 spin_unlock(&exp->exp_lock);
500 CDEBUG(D_CONFIG, "using hash %p\n", obd->obd_nid_stats_hash);
502 OBD_ALLOC_PTR(new_stat);
503 if (new_stat == NULL)
506 new_stat->nid = *nid;
507 new_stat->nid_obd = exp->exp_obd;
508 /* we need set default refcount to 1 to balance obd_disconnect */
509 atomic_set(&new_stat->nid_exp_ref_count, 1);
511 old_stat = cfs_hash_findadd_unique(obd->obd_nid_stats_hash,
512 nid, &new_stat->nid_hash);
513 CDEBUG(D_INFO, "Found stats %p for nid %s - ref %d\n",
514 old_stat, nidstr, atomic_read(&old_stat->nid_exp_ref_count));
516 /* Return -EALREADY here so that we know that the /proc
517 * entry already has been created */
518 if (old_stat != new_stat) {
519 spin_lock(&exp->exp_lock);
520 if (exp->exp_nid_stats) {
521 LASSERT(exp->exp_nid_stats == old_stat);
522 nidstat_putref(exp->exp_nid_stats);
524 exp->exp_nid_stats = old_stat;
525 spin_unlock(&exp->exp_lock);
526 GOTO(destroy_new, rc = -EALREADY);
528 /* not found - create */
529 new_stat->nid_proc = lprocfs_register(nidstr,
530 obd->obd_proc_exports_entry,
533 if (IS_ERR(new_stat->nid_proc)) {
534 rc = PTR_ERR(new_stat->nid_proc);
535 new_stat->nid_proc = NULL;
536 CERROR("%s: cannot create proc entry for export %s: rc = %d\n",
537 obd->obd_name, nidstr, rc);
538 GOTO(destroy_new_ns, rc);
541 entry = lprocfs_add_simple(new_stat->nid_proc, "nodemap", new_stat,
542 &lprocfs_exp_nodemap_fops);
545 CWARN("%s: error adding the nodemap file: rc = %d\n",
547 GOTO(destroy_new_ns, rc);
550 entry = lprocfs_add_simple(new_stat->nid_proc, "uuid", new_stat,
551 &lprocfs_exp_uuid_fops);
554 CWARN("%s: error adding the NID stats file: rc = %d\n",
556 GOTO(destroy_new_ns, rc);
559 entry = lprocfs_add_simple(new_stat->nid_proc, "hash", new_stat,
560 &lprocfs_exp_hash_fops);
563 CWARN("%s: error adding the hash file: rc = %d\n",
565 GOTO(destroy_new_ns, rc);
568 entry = lprocfs_add_simple(new_stat->nid_proc, "export",
569 new_stat, &lprocfs_exp_export_fops);
572 CWARN("%s: error adding the export file: rc = %d\n",
574 GOTO(destroy_new_ns, rc);
577 entry = lprocfs_add_simple(new_stat->nid_proc, "reply_data", new_stat,
578 &lprocfs_exp_replydata_fops);
581 CWARN("%s: error adding the reply_data file: rc = %d\n",
583 GOTO(destroy_new_ns, rc);
586 entry = lprocfs_add_simple(new_stat->nid_proc, "fmd_count", new_stat,
587 &lprocfs_exp_fmd_count_fops);
590 CWARN("%s: error adding the fmd_count file: rc = %d\n",
592 GOTO(destroy_new_ns, rc);
595 spin_lock(&exp->exp_lock);
596 exp->exp_nid_stats = new_stat;
597 spin_unlock(&exp->exp_lock);
599 /* protect competitive add to list, not need locking on destroy */
600 spin_lock(&obd->obd_nid_lock);
601 list_add(&new_stat->nid_list, &obd->obd_nid_stats);
602 spin_unlock(&obd->obd_nid_lock);
607 if (new_stat->nid_proc != NULL)
608 lprocfs_remove(&new_stat->nid_proc);
609 cfs_hash_del(obd->obd_nid_stats_hash, nid, &new_stat->nid_hash);
612 nidstat_putref(new_stat);
613 OBD_FREE_PTR(new_stat);
616 EXPORT_SYMBOL(lprocfs_exp_setup);
618 int lprocfs_exp_cleanup(struct obd_export *exp)
620 struct nid_stat *stat = exp->exp_nid_stats;
622 if (!stat || !exp->exp_obd)
625 nidstat_putref(exp->exp_nid_stats);
626 exp->exp_nid_stats = NULL;
631 int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned int num_stats)
633 struct lprocfs_stats *stats;
636 LASSERT(obd->obd_stats == NULL);
637 LASSERT(obd->obd_proc_entry != NULL);
639 stats = lprocfs_alloc_stats(num_stats, 0);
643 rc = lprocfs_register_stats(obd->obd_proc_entry, "stats", stats);
645 lprocfs_free_stats(&stats);
647 obd->obd_stats = stats;
651 EXPORT_SYMBOL(lprocfs_alloc_obd_stats);
653 void lprocfs_free_obd_stats(struct obd_device *obd)
656 lprocfs_free_stats(&obd->obd_stats);
658 EXPORT_SYMBOL(lprocfs_free_obd_stats);
660 int lprocfs_hash_seq_show(struct seq_file *m, void *data)
662 struct obd_device *obd = m->private;
667 /* header for rhashtable state */
668 seq_printf(m, "%-*s cur min max theta t-min t-max flags rehash count maxdep distribution\n",
669 HASH_NAME_LEN, "name");
670 ldebugfs_rhash_seq_show("UUID_HASH", &obd->obd_uuid_hash, m);
671 ldebugfs_rhash_seq_show("NID_HASH", &obd->obd_nid_hash.ht, m);
673 cfs_hash_debug_header(m);
674 cfs_hash_debug_str(obd->obd_nid_stats_hash, m);
677 EXPORT_SYMBOL(lprocfs_hash_seq_show);
679 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data)
681 struct obd_device *obd = m->private;
682 struct target_distribute_txn_data *tdtd;
684 LASSERT(obd != NULL);
686 seq_printf(m, "status: ");
687 if (atomic_read(&obd->obd_max_recoverable_clients) == 0) {
688 seq_printf(m, "INACTIVE\n");
692 /* sampled unlocked, but really... */
693 if (obd->obd_recovering == 0) {
694 seq_printf(m, "COMPLETE\n");
695 seq_printf(m, "recovery_start: %lld\n",
696 (s64)ktime_get_real_seconds() -
697 (ktime_get_seconds() - obd->obd_recovery_start));
698 seq_printf(m, "recovery_duration: %lld\n",
699 obd->obd_recovery_end ?
700 obd->obd_recovery_end - obd->obd_recovery_start :
701 ktime_get_seconds() - obd->obd_recovery_start);
702 /* Number of clients that have completed recovery */
703 seq_printf(m, "completed_clients: %d/%d\n",
704 atomic_read(&obd->obd_max_recoverable_clients) -
705 obd->obd_stale_clients,
706 atomic_read(&obd->obd_max_recoverable_clients));
707 seq_printf(m, "replayed_requests: %d\n",
708 obd->obd_replayed_requests);
709 seq_printf(m, "last_transno: %lld\n",
710 obd->obd_next_recovery_transno - 1);
711 seq_printf(m, "VBR: %s\n", obd->obd_version_recov ?
712 "ENABLED" : "DISABLED");
713 seq_printf(m, "IR: %s\n", obd->obd_no_ir ?
714 "DISABLED" : "ENABLED");
718 tdtd = obd->u.obt.obt_lut->lut_tdtd;
719 if (tdtd && tdtd->tdtd_show_update_logs_retrievers) {
724 buf = tdtd->tdtd_show_update_logs_retrievers(
725 tdtd->tdtd_show_retrievers_cbdata,
728 seq_printf(m, "WAITING\n");
729 seq_printf(m, "non-ready MDTs: %s\n",
730 buf ? buf : "unknown (not enough RAM)");
731 seq_printf(m, "recovery_start: %lld\n",
732 (s64)ktime_get_real_seconds() -
733 (ktime_get_seconds() -
734 obd->obd_recovery_start));
735 seq_printf(m, "time_waited: %lld\n",
736 (s64)(ktime_get_seconds() -
737 obd->obd_recovery_start));
743 if (likely(count > 0))
747 /* recovery won't start until the clients connect */
748 if (obd->obd_recovery_start == 0) {
749 seq_printf(m, "WAITING_FOR_CLIENTS\n");
753 seq_printf(m, "RECOVERING\n");
754 seq_printf(m, "recovery_start: %lld\n", (s64)ktime_get_real_seconds() -
755 (ktime_get_seconds() - obd->obd_recovery_start));
756 seq_printf(m, "time_remaining: %lld\n",
757 ktime_get_seconds() >=
758 obd->obd_recovery_start +
759 obd->obd_recovery_timeout ? 0 :
760 (s64)(obd->obd_recovery_start +
761 obd->obd_recovery_timeout -
762 ktime_get_seconds()));
763 seq_printf(m, "connected_clients: %d/%d\n",
764 atomic_read(&obd->obd_connected_clients),
765 atomic_read(&obd->obd_max_recoverable_clients));
766 /* Number of clients that have completed recovery */
767 seq_printf(m, "req_replay_clients: %d\n",
768 atomic_read(&obd->obd_req_replay_clients));
769 seq_printf(m, "lock_repay_clients: %d\n",
770 atomic_read(&obd->obd_lock_replay_clients));
771 seq_printf(m, "completed_clients: %d\n",
772 atomic_read(&obd->obd_connected_clients) -
773 atomic_read(&obd->obd_lock_replay_clients));
774 seq_printf(m, "evicted_clients: %d\n", obd->obd_stale_clients);
775 seq_printf(m, "replayed_requests: %d\n", obd->obd_replayed_requests);
776 seq_printf(m, "queued_requests: %d\n",
777 obd->obd_requests_queued_for_recovery);
778 seq_printf(m, "next_transno: %lld\n",
779 obd->obd_next_recovery_transno);
783 EXPORT_SYMBOL(lprocfs_recovery_status_seq_show);
785 ssize_t ir_factor_show(struct kobject *kobj, struct attribute *attr,
788 struct obd_device *obd = container_of(kobj, struct obd_device,
791 return scnprintf(buf, PAGE_SIZE, "%d\n", obd->obd_recovery_ir_factor);
793 EXPORT_SYMBOL(ir_factor_show);
795 ssize_t ir_factor_store(struct kobject *kobj, struct attribute *attr,
796 const char *buffer, size_t count)
798 struct obd_device *obd = container_of(kobj, struct obd_device,
803 rc = kstrtoint(buffer, 10, &val);
807 if (val < OBD_IR_FACTOR_MIN || val > OBD_IR_FACTOR_MAX)
810 obd->obd_recovery_ir_factor = val;
813 EXPORT_SYMBOL(ir_factor_store);
815 int lprocfs_checksum_dump_seq_show(struct seq_file *m, void *data)
817 struct obd_device *obd = m->private;
819 LASSERT(obd != NULL);
820 seq_printf(m, "%d\n", obd->obd_checksum_dump);
823 EXPORT_SYMBOL(lprocfs_checksum_dump_seq_show);
826 lprocfs_checksum_dump_seq_write(struct file *file, const char __user *buffer,
827 size_t count, loff_t *off)
829 struct seq_file *m = file->private_data;
830 struct obd_device *obd = m->private;
834 LASSERT(obd != NULL);
835 rc = kstrtobool_from_user(buffer, count, &val);
839 obd->obd_checksum_dump = val;
842 EXPORT_SYMBOL(lprocfs_checksum_dump_seq_write);
844 ssize_t recovery_time_soft_show(struct kobject *kobj, struct attribute *attr,
847 struct obd_device *obd = container_of(kobj, struct obd_device,
850 return scnprintf(buf, PAGE_SIZE, "%d\n", obd->obd_recovery_timeout);
852 EXPORT_SYMBOL(recovery_time_soft_show);
854 ssize_t recovery_time_soft_store(struct kobject *kobj,
855 struct attribute *attr,
856 const char *buffer, size_t count)
858 struct obd_device *obd = container_of(kobj, struct obd_device,
863 rc = kstrtouint(buffer, 0, &val);
867 obd->obd_recovery_timeout = val;
870 EXPORT_SYMBOL(recovery_time_soft_store);
872 ssize_t recovery_time_hard_show(struct kobject *kobj, struct attribute *attr,
875 struct obd_device *obd = container_of(kobj, struct obd_device,
878 return scnprintf(buf, PAGE_SIZE, "%d\n", obd->obd_recovery_time_hard);
880 EXPORT_SYMBOL(recovery_time_hard_show);
882 ssize_t recovery_time_hard_store(struct kobject *kobj,
883 struct attribute *attr,
884 const char *buffer, size_t count)
886 struct obd_device *obd = container_of(kobj, struct obd_device,
891 rc = kstrtouint(buffer, 0, &val);
895 obd->obd_recovery_time_hard = val;
898 EXPORT_SYMBOL(recovery_time_hard_store);
900 ssize_t instance_show(struct kobject *kobj, struct attribute *attr,
903 struct obd_device *obd = container_of(kobj, struct obd_device,
905 struct obd_device_target *target = &obd->u.obt;
907 LASSERT(target->obt_magic == OBT_MAGIC);
908 return scnprintf(buf, PAGE_SIZE, "%u\n", obd->u.obt.obt_instance);
910 EXPORT_SYMBOL(instance_show);
912 #endif /* CONFIG_PROC_FS*/