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 = skip_spaces(kbuf);
128 tmpbuf = strsep(&tmpbuf, " \t\n\f\v\r");
129 class_incref(obd, __func__, current);
131 if (strncmp(tmpbuf, "nid:", 4) == 0)
132 obd_export_evict_by_nid(obd, tmpbuf + 4);
133 else if (strncmp(tmpbuf, "uuid:", 5) == 0)
134 obd_export_evict_by_uuid(obd, tmpbuf + 5);
136 obd_export_evict_by_uuid(obd, tmpbuf);
138 class_decref(obd, __func__, current);
141 OBD_FREE(kbuf, BUFLEN);
144 EXPORT_SYMBOL(lprocfs_evict_client_seq_write);
148 ssize_t num_exports_show(struct kobject *kobj, struct attribute *attr,
151 struct obd_device *obd = container_of(kobj, struct obd_device,
154 return scnprintf(buf, PAGE_SIZE, "%u\n", obd->obd_num_exports);
156 EXPORT_SYMBOL(num_exports_show);
158 static int obd_export_flags2str(struct obd_export *exp, struct seq_file *m)
162 flag2str(exp, failed);
163 flag2str(exp, in_recovery);
164 flag2str(exp, disconnected);
165 flag2str(exp, connecting);
166 flag2str(exp, no_recovery);
172 lprocfs_exp_print_export_seq(struct obd_export *exp, void *cb_data)
174 struct seq_file *m = cb_data;
175 struct obd_device *obd;
176 struct obd_connect_data *ocd;
178 LASSERT(exp != NULL);
179 if (exp->exp_nid_stats == NULL)
182 ocd = &exp->exp_connect_data;
184 seq_printf(m, "%s:\n"
187 " connect_flags: [ ",
188 obd_uuid2str(&exp->exp_client_uuid),
190 obd_export_nid2str(exp));
191 obd_connect_seq_flags2str(m, ocd->ocd_connect_flags,
192 ocd->ocd_connect_flags2, ", ");
193 seq_printf(m, " ]\n");
194 obd_connect_data_seqprint(m, ocd);
195 seq_printf(m, " export_flags: [ ");
196 obd_export_flags2str(exp, m);
197 seq_printf(m, " ]\n");
200 strcmp(obd->obd_type->typ_name, "obdfilter") == 0) {
201 struct filter_export_data *fed = &exp->exp_filter_data;
203 seq_printf(m, " grant:\n");
204 seq_printf(m, " granted: %ld\n",
205 fed->fed_ted.ted_grant);
206 seq_printf(m, " dirty: %ld\n",
207 fed->fed_ted.ted_dirty);
208 seq_printf(m, " pending: %ld\n",
209 fed->fed_ted.ted_pending);
217 * RPC connections are composed of an import and an export. Using the
218 * lctl utility we can extract important information about the state.
219 * The lprocfs_exp_export_seq_show routine displays the state information
222 * \param[in] m seq file
223 * \param[in] data unused
225 * \retval 0 on success
227 * The format of the export state information is like:
228 * a793e354-49c0-aa11-8c4f-a4f2b1a1a92b:
230 * client: 10.211.55.10@tcp
231 * connect_flags: [ version, barrier, adaptive_timeouts, ... ]
233 * flags: 0x2000011005002020
235 * target_version: 2.10.51.0
236 * export_flags: [ ... ]
239 static int lprocfs_exp_export_seq_show(struct seq_file *m, void *data)
241 struct nid_stat *stats = m->private;
243 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
244 lprocfs_exp_print_export_seq, m);
246 LPROC_SEQ_FOPS_RO(lprocfs_exp_export);
248 static void lprocfs_free_client_stats(struct nid_stat *client_stat)
250 CDEBUG(D_CONFIG, "stat %p - data %p/%p\n", client_stat,
251 client_stat->nid_proc, client_stat->nid_stats);
253 LASSERTF(atomic_read(&client_stat->nid_exp_ref_count) == 0,
254 "nid %s:count %d\n", libcfs_nid2str(client_stat->nid),
255 atomic_read(&client_stat->nid_exp_ref_count));
257 if (client_stat->nid_proc)
258 lprocfs_remove(&client_stat->nid_proc);
260 if (client_stat->nid_stats)
261 lprocfs_free_stats(&client_stat->nid_stats);
263 if (client_stat->nid_ldlm_stats)
264 lprocfs_free_stats(&client_stat->nid_ldlm_stats);
266 OBD_FREE_PTR(client_stat);
269 void lprocfs_free_per_client_stats(struct obd_device *obd)
271 struct cfs_hash *hash = obd->obd_nid_stats_hash;
272 struct nid_stat *stat;
275 /* we need extra list - because hash_exit called to early */
276 /* not need locking because all clients is died */
277 while (!list_empty(&obd->obd_nid_stats)) {
278 stat = list_entry(obd->obd_nid_stats.next,
279 struct nid_stat, nid_list);
280 list_del_init(&stat->nid_list);
281 cfs_hash_del(hash, &stat->nid, &stat->nid_hash);
282 lprocfs_free_client_stats(stat);
286 EXPORT_SYMBOL(lprocfs_free_per_client_stats);
289 lprocfs_exp_print_nodemap_seq(struct obd_export *exp, void *cb_data)
291 struct lu_nodemap *nodemap = exp->exp_target_data.ted_nodemap;
292 struct seq_file *m = cb_data;
295 seq_printf(m, "%s\n", nodemap->nm_name);
300 lprocfs_exp_nodemap_seq_show(struct seq_file *m, void *data)
302 struct nid_stat *stats = m->private;
304 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
305 lprocfs_exp_print_nodemap_seq, m);
307 LPROC_SEQ_FOPS_RO(lprocfs_exp_nodemap);
310 lprocfs_exp_print_uuid_seq(struct obd_export *exp, void *cb_data)
312 struct seq_file *m = cb_data;
314 if (exp->exp_nid_stats)
315 seq_printf(m, "%s\n", obd_uuid2str(&exp->exp_client_uuid));
319 static int lprocfs_exp_uuid_seq_show(struct seq_file *m, void *data)
321 struct nid_stat *stats = m->private;
323 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
324 lprocfs_exp_print_uuid_seq, m);
326 LPROC_SEQ_FOPS_RO(lprocfs_exp_uuid);
328 #define HASH_NAME_LEN 16
330 static void ldebugfs_rhash_seq_show(const char *name, struct rhashtable *ht,
333 unsigned int max_size = ht->p.max_size ? ht->p.max_size : UINT_MAX;
334 struct bucket_table *tbl;
335 int dist[8] = { 0, };
340 tbl = rht_dereference(ht->tbl, ht);
341 for (i = 0; i < tbl->size; i++) {
342 struct rhash_head *pos;
345 rht_for_each(pos, tbl, i)
349 maxdep = max(maxdep, count);
351 dist[min(fls(count), 7)]++;
354 seq_printf(m, "%-*s %5d %5d %10u %d.%03d 0.300 0.750 0x%03x %7d %7d %7d ",
355 HASH_NAME_LEN, name, tbl->size, ht->p.min_size, max_size,
356 atomic_read(&ht->nelems) / tbl->size,
357 atomic_read(&ht->nelems) * 1000 / tbl->size,
358 ht->p.automatic_shrinking, 0,
359 atomic_read(&ht->nelems), maxdep);
362 for (i = 0; i < 8; i++)
363 seq_printf(m, "%d%c", dist[i], (i == 7) ? '\n' : '/');
367 lprocfs_exp_print_hash_seq(struct obd_export *exp, void *cb_data)
370 struct obd_device *obd = exp->exp_obd;
371 struct seq_file *m = cb_data;
373 if (exp->exp_lock_hash != NULL) {
374 seq_printf(m, "%-*s cur min max theta t-min t-max flags rehash count distribution\n",
375 HASH_NAME_LEN, "name");
376 ldebugfs_rhash_seq_show("NID_HASH", &obd->obd_nid_hash.ht, m);
381 static int lprocfs_exp_hash_seq_show(struct seq_file *m, void *data)
383 struct nid_stat *stats = m->private;
385 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
386 lprocfs_exp_print_hash_seq, m);
388 LPROC_SEQ_FOPS_RO(lprocfs_exp_hash);
390 int lprocfs_exp_print_replydata_seq(struct obd_export *exp, void *cb_data)
393 struct seq_file *m = cb_data;
394 struct tg_export_data *ted = &exp->exp_target_data;
396 seq_printf(m, "reply_cnt: %d\n"
398 "reply_released_by_xid: %d\n"
399 "reply_released_by_tag: %d\n\n",
402 ted->ted_release_xid,
403 ted->ted_release_tag);
407 int lprocfs_exp_replydata_seq_show(struct seq_file *m, void *data)
409 struct nid_stat *stats = m->private;
411 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
412 lprocfs_exp_print_replydata_seq, m);
414 LPROC_SEQ_FOPS_RO(lprocfs_exp_replydata);
416 int lprocfs_exp_print_fmd_count_seq(struct obd_export *exp, void *cb_data)
418 struct seq_file *m = cb_data;
419 struct tg_export_data *ted = &exp->exp_target_data;
421 seq_printf(m, "%d\n", ted->ted_fmd_count);
426 int lprocfs_exp_fmd_count_seq_show(struct seq_file *m, void *data)
428 struct nid_stat *stats = m->private;
430 return obd_nid_export_for_each(stats->nid_obd, stats->nid,
431 lprocfs_exp_print_fmd_count_seq, m);
433 LPROC_SEQ_FOPS_RO(lprocfs_exp_fmd_count);
435 int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
437 seq_puts(m, "Write into this file to clear all nid stats and stale nid entries\n");
440 EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_show);
442 static int lprocfs_nid_stats_clear_write_cb(void *obj, void *data)
444 struct nid_stat *stat = obj;
447 CDEBUG(D_INFO, "refcnt %d\n", atomic_read(&stat->nid_exp_ref_count));
448 if (atomic_read(&stat->nid_exp_ref_count) == 1) {
449 /* object has only hash references. */
450 spin_lock(&stat->nid_obd->obd_nid_lock);
451 list_move(&stat->nid_list, data);
452 spin_unlock(&stat->nid_obd->obd_nid_lock);
455 /* we has reference to object - only clear data*/
457 lprocfs_clear_stats(stat->nid_stats);
463 lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
464 size_t count, loff_t *off)
466 struct seq_file *m = file->private_data;
467 struct obd_device *obd = m->private;
468 struct nid_stat *client_stat;
469 LIST_HEAD(free_list);
471 cfs_hash_cond_del(obd->obd_nid_stats_hash,
472 lprocfs_nid_stats_clear_write_cb, &free_list);
474 while (!list_empty(&free_list)) {
475 client_stat = list_entry(free_list.next, struct nid_stat,
477 list_del_init(&client_stat->nid_list);
478 lprocfs_free_client_stats(client_stat);
482 EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_write);
484 int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid)
486 struct nid_stat *new_stat, *old_stat;
487 struct obd_device *obd = NULL;
488 struct proc_dir_entry *entry;
489 char nidstr[LNET_NIDSTR_SIZE];
493 if (!exp || !exp->exp_obd || !exp->exp_obd->obd_proc_exports_entry ||
494 !exp->exp_obd->obd_nid_stats_hash)
497 /* not test against zero because eric say:
498 * You may only test nid against another nid, or LNET_NID_ANY.
499 * Anything else is nonsense.*/
500 if (nid == NULL || *nid == LNET_NID_ANY)
503 libcfs_nid2str_r(*nid, nidstr, sizeof(nidstr));
505 spin_lock(&exp->exp_lock);
506 if (exp->exp_nid_stats != NULL) {
507 spin_unlock(&exp->exp_lock);
510 spin_unlock(&exp->exp_lock);
514 CDEBUG(D_CONFIG, "using hash %p\n", obd->obd_nid_stats_hash);
516 OBD_ALLOC_PTR(new_stat);
517 if (new_stat == NULL)
520 new_stat->nid = *nid;
521 new_stat->nid_obd = exp->exp_obd;
522 /* we need set default refcount to 1 to balance obd_disconnect */
523 atomic_set(&new_stat->nid_exp_ref_count, 1);
525 old_stat = cfs_hash_findadd_unique(obd->obd_nid_stats_hash,
526 nid, &new_stat->nid_hash);
527 CDEBUG(D_INFO, "Found stats %p for nid %s - ref %d\n",
528 old_stat, nidstr, atomic_read(&old_stat->nid_exp_ref_count));
530 /* Return -EALREADY here so that we know that the /proc
531 * entry already has been created */
532 if (old_stat != new_stat) {
533 spin_lock(&exp->exp_lock);
534 if (exp->exp_nid_stats) {
535 LASSERT(exp->exp_nid_stats == old_stat);
536 nidstat_putref(exp->exp_nid_stats);
538 exp->exp_nid_stats = old_stat;
539 spin_unlock(&exp->exp_lock);
540 GOTO(destroy_new, rc = -EALREADY);
542 /* not found - create */
543 new_stat->nid_proc = lprocfs_register(nidstr,
544 obd->obd_proc_exports_entry,
547 if (IS_ERR(new_stat->nid_proc)) {
548 rc = PTR_ERR(new_stat->nid_proc);
549 new_stat->nid_proc = NULL;
550 CERROR("%s: cannot create proc entry for export %s: rc = %d\n",
551 obd->obd_name, nidstr, rc);
552 GOTO(destroy_new_ns, rc);
555 entry = lprocfs_add_simple(new_stat->nid_proc, "nodemap", new_stat,
556 &lprocfs_exp_nodemap_fops);
559 CWARN("%s: error adding the nodemap file: rc = %d\n",
561 GOTO(destroy_new_ns, rc);
564 entry = lprocfs_add_simple(new_stat->nid_proc, "uuid", new_stat,
565 &lprocfs_exp_uuid_fops);
568 CWARN("%s: error adding the NID stats file: rc = %d\n",
570 GOTO(destroy_new_ns, rc);
573 entry = lprocfs_add_simple(new_stat->nid_proc, "hash", new_stat,
574 &lprocfs_exp_hash_fops);
577 CWARN("%s: error adding the hash file: rc = %d\n",
579 GOTO(destroy_new_ns, rc);
582 entry = lprocfs_add_simple(new_stat->nid_proc, "export",
583 new_stat, &lprocfs_exp_export_fops);
586 CWARN("%s: error adding the export file: rc = %d\n",
588 GOTO(destroy_new_ns, rc);
591 entry = lprocfs_add_simple(new_stat->nid_proc, "reply_data", new_stat,
592 &lprocfs_exp_replydata_fops);
595 CWARN("%s: error adding the reply_data file: rc = %d\n",
597 GOTO(destroy_new_ns, rc);
600 entry = lprocfs_add_simple(new_stat->nid_proc, "fmd_count", new_stat,
601 &lprocfs_exp_fmd_count_fops);
604 CWARN("%s: error adding the fmd_count file: rc = %d\n",
606 GOTO(destroy_new_ns, rc);
609 spin_lock(&exp->exp_lock);
610 exp->exp_nid_stats = new_stat;
611 spin_unlock(&exp->exp_lock);
613 /* protect competitive add to list, not need locking on destroy */
614 spin_lock(&obd->obd_nid_lock);
615 list_add(&new_stat->nid_list, &obd->obd_nid_stats);
616 spin_unlock(&obd->obd_nid_lock);
621 if (new_stat->nid_proc != NULL)
622 lprocfs_remove(&new_stat->nid_proc);
623 cfs_hash_del(obd->obd_nid_stats_hash, nid, &new_stat->nid_hash);
626 nidstat_putref(new_stat);
627 OBD_FREE_PTR(new_stat);
630 EXPORT_SYMBOL(lprocfs_exp_setup);
632 int lprocfs_exp_cleanup(struct obd_export *exp)
634 struct nid_stat *stat = exp->exp_nid_stats;
636 if (!stat || !exp->exp_obd)
639 nidstat_putref(exp->exp_nid_stats);
640 exp->exp_nid_stats = NULL;
645 int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned int num_stats)
647 struct lprocfs_stats *stats;
650 LASSERT(obd->obd_stats == NULL);
651 LASSERT(obd->obd_proc_entry != NULL);
653 stats = lprocfs_alloc_stats(num_stats, 0);
657 rc = lprocfs_register_stats(obd->obd_proc_entry, "stats", stats);
659 lprocfs_free_stats(&stats);
661 obd->obd_stats = stats;
665 EXPORT_SYMBOL(lprocfs_alloc_obd_stats);
667 void lprocfs_free_obd_stats(struct obd_device *obd)
670 lprocfs_free_stats(&obd->obd_stats);
672 EXPORT_SYMBOL(lprocfs_free_obd_stats);
674 int lprocfs_hash_seq_show(struct seq_file *m, void *data)
676 struct obd_device *obd = m->private;
681 /* header for rhashtable state */
682 seq_printf(m, "%-*s cur min max theta t-min t-max flags rehash count maxdep distribution\n",
683 HASH_NAME_LEN, "name");
684 ldebugfs_rhash_seq_show("UUID_HASH", &obd->obd_uuid_hash, m);
685 ldebugfs_rhash_seq_show("NID_HASH", &obd->obd_nid_hash.ht, m);
687 cfs_hash_debug_header(m);
688 cfs_hash_debug_str(obd->obd_nid_stats_hash, m);
691 EXPORT_SYMBOL(lprocfs_hash_seq_show);
693 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data)
695 struct obd_device *obd = m->private;
696 struct target_distribute_txn_data *tdtd;
698 LASSERT(obd != NULL);
700 seq_printf(m, "status: ");
701 if (atomic_read(&obd->obd_max_recoverable_clients) == 0) {
702 seq_printf(m, "INACTIVE\n");
706 /* sampled unlocked, but really... */
707 if (obd->obd_recovering == 0) {
708 seq_printf(m, "COMPLETE\n");
709 seq_printf(m, "recovery_start: %lld\n",
710 (s64)ktime_get_real_seconds() -
711 (ktime_get_seconds() - obd->obd_recovery_start));
712 seq_printf(m, "recovery_duration: %lld\n",
713 obd->obd_recovery_end ?
714 obd->obd_recovery_end - obd->obd_recovery_start :
715 ktime_get_seconds() - obd->obd_recovery_start);
716 /* Number of clients that have completed recovery */
717 seq_printf(m, "completed_clients: %d/%d\n",
718 atomic_read(&obd->obd_max_recoverable_clients) -
719 obd->obd_stale_clients,
720 atomic_read(&obd->obd_max_recoverable_clients));
721 seq_printf(m, "replayed_requests: %d\n",
722 obd->obd_replayed_requests);
723 seq_printf(m, "last_transno: %lld\n",
724 obd->obd_next_recovery_transno - 1);
725 seq_printf(m, "VBR: %s\n", obd->obd_version_recov ?
726 "ENABLED" : "DISABLED");
727 seq_printf(m, "IR: %s\n", obd->obd_no_ir ?
728 "DISABLED" : "ENABLED");
732 tdtd = obd->u.obt.obt_lut->lut_tdtd;
733 if (tdtd && tdtd->tdtd_show_update_logs_retrievers) {
738 buf = tdtd->tdtd_show_update_logs_retrievers(
739 tdtd->tdtd_show_retrievers_cbdata,
742 seq_printf(m, "WAITING\n");
743 seq_printf(m, "non-ready MDTs: %s\n",
744 buf ? buf : "unknown (not enough RAM)");
745 seq_printf(m, "recovery_start: %lld\n",
746 (s64)ktime_get_real_seconds() -
747 (ktime_get_seconds() -
748 obd->obd_recovery_start));
749 seq_printf(m, "time_waited: %lld\n",
750 (s64)(ktime_get_seconds() -
751 obd->obd_recovery_start));
757 if (likely(count > 0))
761 /* recovery won't start until the clients connect */
762 if (obd->obd_recovery_start == 0) {
763 seq_printf(m, "WAITING_FOR_CLIENTS\n");
767 seq_printf(m, "RECOVERING\n");
768 seq_printf(m, "recovery_start: %lld\n", (s64)ktime_get_real_seconds() -
769 (ktime_get_seconds() - obd->obd_recovery_start));
770 seq_printf(m, "time_remaining: %lld\n",
771 ktime_get_seconds() >=
772 obd->obd_recovery_start +
773 obd->obd_recovery_timeout ? 0 :
774 (s64)(obd->obd_recovery_start +
775 obd->obd_recovery_timeout -
776 ktime_get_seconds()));
777 seq_printf(m, "connected_clients: %d/%d\n",
778 atomic_read(&obd->obd_connected_clients),
779 atomic_read(&obd->obd_max_recoverable_clients));
780 /* Number of clients that have completed recovery */
781 seq_printf(m, "req_replay_clients: %d\n",
782 atomic_read(&obd->obd_req_replay_clients));
783 seq_printf(m, "lock_repay_clients: %d\n",
784 atomic_read(&obd->obd_lock_replay_clients));
785 seq_printf(m, "completed_clients: %d\n",
786 atomic_read(&obd->obd_connected_clients) -
787 atomic_read(&obd->obd_lock_replay_clients));
788 seq_printf(m, "evicted_clients: %d\n", obd->obd_stale_clients);
789 seq_printf(m, "replayed_requests: %d\n", obd->obd_replayed_requests);
790 seq_printf(m, "queued_requests: %d\n",
791 obd->obd_requests_queued_for_recovery);
792 seq_printf(m, "next_transno: %lld\n",
793 obd->obd_next_recovery_transno);
797 EXPORT_SYMBOL(lprocfs_recovery_status_seq_show);
799 ssize_t ir_factor_show(struct kobject *kobj, struct attribute *attr,
802 struct obd_device *obd = container_of(kobj, struct obd_device,
805 return scnprintf(buf, PAGE_SIZE, "%d\n", obd->obd_recovery_ir_factor);
807 EXPORT_SYMBOL(ir_factor_show);
809 ssize_t ir_factor_store(struct kobject *kobj, struct attribute *attr,
810 const char *buffer, size_t count)
812 struct obd_device *obd = container_of(kobj, struct obd_device,
817 rc = kstrtoint(buffer, 10, &val);
821 if (val < OBD_IR_FACTOR_MIN || val > OBD_IR_FACTOR_MAX)
824 obd->obd_recovery_ir_factor = val;
827 EXPORT_SYMBOL(ir_factor_store);
829 int lprocfs_checksum_dump_seq_show(struct seq_file *m, void *data)
831 struct obd_device *obd = m->private;
833 LASSERT(obd != NULL);
834 seq_printf(m, "%d\n", obd->obd_checksum_dump);
837 EXPORT_SYMBOL(lprocfs_checksum_dump_seq_show);
840 lprocfs_checksum_dump_seq_write(struct file *file, const char __user *buffer,
841 size_t count, loff_t *off)
843 struct seq_file *m = file->private_data;
844 struct obd_device *obd = m->private;
848 LASSERT(obd != NULL);
849 rc = kstrtobool_from_user(buffer, count, &val);
853 obd->obd_checksum_dump = val;
856 EXPORT_SYMBOL(lprocfs_checksum_dump_seq_write);
858 ssize_t recovery_time_soft_show(struct kobject *kobj, struct attribute *attr,
861 struct obd_device *obd = container_of(kobj, struct obd_device,
864 return scnprintf(buf, PAGE_SIZE, "%d\n", obd->obd_recovery_timeout);
866 EXPORT_SYMBOL(recovery_time_soft_show);
868 ssize_t recovery_time_soft_store(struct kobject *kobj,
869 struct attribute *attr,
870 const char *buffer, size_t count)
872 struct obd_device *obd = container_of(kobj, struct obd_device,
877 rc = kstrtouint(buffer, 0, &val);
881 obd->obd_recovery_timeout = val;
884 EXPORT_SYMBOL(recovery_time_soft_store);
886 ssize_t recovery_time_hard_show(struct kobject *kobj, struct attribute *attr,
889 struct obd_device *obd = container_of(kobj, struct obd_device,
892 return scnprintf(buf, PAGE_SIZE, "%d\n", obd->obd_recovery_time_hard);
894 EXPORT_SYMBOL(recovery_time_hard_show);
896 ssize_t recovery_time_hard_store(struct kobject *kobj,
897 struct attribute *attr,
898 const char *buffer, size_t count)
900 struct obd_device *obd = container_of(kobj, struct obd_device,
905 rc = kstrtouint(buffer, 0, &val);
909 obd->obd_recovery_time_hard = val;
912 EXPORT_SYMBOL(recovery_time_hard_store);
914 ssize_t instance_show(struct kobject *kobj, struct attribute *attr,
917 struct obd_device *obd = container_of(kobj, struct obd_device,
919 struct obd_device_target *target = &obd->u.obt;
921 LASSERT(target->obt_magic == OBT_MAGIC);
922 return scnprintf(buf, PAGE_SIZE, "%u\n", obd->u.obt.obt_instance);
924 EXPORT_SYMBOL(instance_show);
926 #endif /* CONFIG_PROC_FS*/