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.sun.com/software/products/lustre/docs/GPLv2.pdf
23 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2014, 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/obdclass/lprocfs_status_server.c
35 #define DEBUG_SUBSYSTEM S_CLASS
38 #include <obd_class.h>
39 #include <lprocfs_status.h>
40 #include <lustre/lustre_idl.h>
41 #include <lustre_nodemap.h>
45 int lprocfs_evict_client_open(struct inode *inode, struct file *f)
47 struct obd_device *obd = PDE_DATA(f->f_path.dentry->d_inode);
49 atomic_inc(&obd->obd_evict_inprogress);
53 int lprocfs_evict_client_release(struct inode *inode, struct file *f)
55 struct obd_device *obd = PDE_DATA(f->f_path.dentry->d_inode);
57 atomic_dec(&obd->obd_evict_inprogress);
58 wake_up(&obd->obd_evict_inprogress_waitq);
63 #define BUFLEN (UUID_MAX + 5)
66 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
67 size_t count, loff_t *off)
69 struct seq_file *m = file->private_data;
70 struct obd_device *obd = m->private;
73 OBD_ALLOC(kbuf, BUFLEN);
78 * OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
79 * bytes into kbuf, to ensure that the string is NUL-terminated.
80 * UUID_MAX should include a trailing NUL already.
82 if (copy_from_user(kbuf, buffer,
83 min_t(unsigned long, BUFLEN - 1, count))) {
87 tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count));
88 class_incref(obd, __func__, current);
90 if (strncmp(tmpbuf, "nid:", 4) == 0)
91 obd_export_evict_by_nid(obd, tmpbuf + 4);
92 else if (strncmp(tmpbuf, "uuid:", 5) == 0)
93 obd_export_evict_by_uuid(obd, tmpbuf + 5);
95 obd_export_evict_by_uuid(obd, tmpbuf);
97 class_decref(obd, __func__, current);
100 OBD_FREE(kbuf, BUFLEN);
103 EXPORT_SYMBOL(lprocfs_evict_client_seq_write);
107 int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
109 struct obd_device *obd = data;
111 LASSERT(obd != NULL);
112 return seq_printf(m, "%u\n", obd->obd_num_exports);
114 EXPORT_SYMBOL(lprocfs_num_exports_seq_show);
116 static void lprocfs_free_client_stats(struct nid_stat *client_stat)
118 CDEBUG(D_CONFIG, "stat %p - data %p/%p\n", client_stat,
119 client_stat->nid_proc, client_stat->nid_stats);
121 LASSERTF(atomic_read(&client_stat->nid_exp_ref_count) == 0,
122 "nid %s:count %d\n", libcfs_nid2str(client_stat->nid),
123 atomic_read(&client_stat->nid_exp_ref_count));
125 if (client_stat->nid_proc)
126 lprocfs_remove(&client_stat->nid_proc);
128 if (client_stat->nid_stats)
129 lprocfs_free_stats(&client_stat->nid_stats);
131 if (client_stat->nid_ldlm_stats)
132 lprocfs_free_stats(&client_stat->nid_ldlm_stats);
134 OBD_FREE_PTR(client_stat);
138 void lprocfs_free_per_client_stats(struct obd_device *obd)
140 struct cfs_hash *hash = obd->obd_nid_stats_hash;
141 struct nid_stat *stat;
144 /* we need extra list - because hash_exit called to early */
145 /* not need locking because all clients is died */
146 while (!list_empty(&obd->obd_nid_stats)) {
147 stat = list_entry(obd->obd_nid_stats.next,
148 struct nid_stat, nid_list);
149 list_del_init(&stat->nid_list);
150 cfs_hash_del(hash, &stat->nid, &stat->nid_hash);
151 lprocfs_free_client_stats(stat);
155 EXPORT_SYMBOL(lprocfs_free_per_client_stats);
158 lprocfs_exp_print_uuid_seq(struct cfs_hash *hs, struct cfs_hash_bd *bd,
159 struct hlist_node *hnode, void *cb_data)
161 struct seq_file *m = cb_data;
162 struct obd_export *exp = cfs_hash_object(hs, hnode);
164 if (exp->exp_nid_stats != NULL)
165 seq_printf(m, "%s\n", obd_uuid2str(&exp->exp_client_uuid));
170 lprocfs_exp_print_nodemap_seq(struct cfs_hash *hs, struct cfs_hash_bd *bd,
171 struct hlist_node *hnode, void *cb_data)
173 struct seq_file *m = cb_data;
174 struct obd_export *exp = cfs_hash_object(hs, hnode);
175 struct lu_nodemap *nodemap = exp->exp_target_data.ted_nodemap;
178 seq_printf(m, "%s\n", nodemap->nm_name);
183 lprocfs_exp_nodemap_seq_show(struct seq_file *m, void *data)
185 struct nid_stat *stats = m->private;
186 struct obd_device *obd = stats->nid_obd;
188 cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
189 lprocfs_exp_print_nodemap_seq, m);
192 LPROC_SEQ_FOPS_RO(lprocfs_exp_nodemap);
194 static int lprocfs_exp_uuid_seq_show(struct seq_file *m, void *data)
196 struct nid_stat *stats = m->private;
197 struct obd_device *obd = stats->nid_obd;
199 cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
200 lprocfs_exp_print_uuid_seq, m);
203 LPROC_SEQ_FOPS_RO(lprocfs_exp_uuid);
206 lprocfs_exp_print_hash_seq(struct cfs_hash *hs, struct cfs_hash_bd *bd,
207 struct hlist_node *hnode, void *cb_data)
210 struct seq_file *m = cb_data;
211 struct obd_export *exp = cfs_hash_object(hs, hnode);
213 if (exp->exp_lock_hash != NULL) {
214 cfs_hash_debug_header(m);
215 cfs_hash_debug_str(hs, m);
220 static int lprocfs_exp_hash_seq_show(struct seq_file *m, void *data)
222 struct nid_stat *stats = m->private;
223 struct obd_device *obd = stats->nid_obd;
225 cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
226 lprocfs_exp_print_hash_seq, m);
229 LPROC_SEQ_FOPS_RO(lprocfs_exp_hash);
231 int lprocfs_exp_print_replydata_seq(struct cfs_hash *hs, struct cfs_hash_bd *bd,
232 struct hlist_node *hnode, void *cb_data)
235 struct obd_export *exp = cfs_hash_object(hs, hnode);
236 struct seq_file *m = cb_data;
237 struct tg_export_data *ted = &exp->exp_target_data;
239 seq_printf(m, "reply_cnt: %d\n"
241 "reply_released_by_xid: %d\n"
242 "reply_released_by_tag: %d\n\n",
245 ted->ted_release_xid,
246 ted->ted_release_tag);
250 int lprocfs_exp_replydata_seq_show(struct seq_file *m, void *data)
252 struct nid_stat *stats = m->private;
253 struct obd_device *obd = stats->nid_obd;
255 cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
256 lprocfs_exp_print_replydata_seq, m);
259 LPROC_SEQ_FOPS_RO(lprocfs_exp_replydata);
261 int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
263 return seq_printf(m, "%s\n", "Write into this file to clear all nid "
264 "stats and stale nid entries");
266 EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_show);
268 static int lprocfs_nid_stats_clear_write_cb(void *obj, void *data)
270 struct nid_stat *stat = obj;
273 CDEBUG(D_INFO, "refcnt %d\n", atomic_read(&stat->nid_exp_ref_count));
274 if (atomic_read(&stat->nid_exp_ref_count) == 1) {
275 /* object has only hash references. */
276 spin_lock(&stat->nid_obd->obd_nid_lock);
277 list_move(&stat->nid_list, data);
278 spin_unlock(&stat->nid_obd->obd_nid_lock);
281 /* we has reference to object - only clear data*/
283 lprocfs_clear_stats(stat->nid_stats);
289 lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
290 size_t count, loff_t *off)
292 struct seq_file *m = file->private_data;
293 struct obd_device *obd = m->private;
294 struct nid_stat *client_stat;
295 struct list_head free_list;
297 INIT_LIST_HEAD(&free_list);
298 cfs_hash_cond_del(obd->obd_nid_stats_hash,
299 lprocfs_nid_stats_clear_write_cb, &free_list);
301 while (!list_empty(&free_list)) {
302 client_stat = list_entry(free_list.next, struct nid_stat,
304 list_del_init(&client_stat->nid_list);
305 lprocfs_free_client_stats(client_stat);
309 EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_write);
311 int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid)
313 struct nid_stat *new_stat, *old_stat;
314 struct obd_device *obd = NULL;
315 struct proc_dir_entry *entry;
316 char nidstr[LNET_NIDSTR_SIZE];
320 if (!exp || !exp->exp_obd || !exp->exp_obd->obd_proc_exports_entry ||
321 !exp->exp_obd->obd_nid_stats_hash)
324 /* not test against zero because eric say:
325 * You may only test nid against another nid, or LNET_NID_ANY.
326 * Anything else is nonsense.*/
327 if (nid == NULL || *nid == LNET_NID_ANY)
330 libcfs_nid2str_r(*nid, nidstr, sizeof(nidstr));
332 spin_lock(&exp->exp_lock);
333 if (exp->exp_nid_stats != NULL) {
334 spin_unlock(&exp->exp_lock);
337 spin_unlock(&exp->exp_lock);
341 CDEBUG(D_CONFIG, "using hash %p\n", obd->obd_nid_stats_hash);
343 OBD_ALLOC_PTR(new_stat);
344 if (new_stat == NULL)
347 new_stat->nid = *nid;
348 new_stat->nid_obd = exp->exp_obd;
349 /* we need set default refcount to 1 to balance obd_disconnect */
350 atomic_set(&new_stat->nid_exp_ref_count, 1);
352 old_stat = cfs_hash_findadd_unique(obd->obd_nid_stats_hash,
353 nid, &new_stat->nid_hash);
354 CDEBUG(D_INFO, "Found stats %p for nid %s - ref %d\n",
355 old_stat, nidstr, atomic_read(&old_stat->nid_exp_ref_count));
357 /* Return -EALREADY here so that we know that the /proc
358 * entry already has been created */
359 if (old_stat != new_stat) {
360 spin_lock(&exp->exp_lock);
361 if (exp->exp_nid_stats) {
362 LASSERT(exp->exp_nid_stats == old_stat);
363 nidstat_putref(exp->exp_nid_stats);
365 exp->exp_nid_stats = old_stat;
366 spin_unlock(&exp->exp_lock);
367 GOTO(destroy_new, rc = -EALREADY);
369 /* not found - create */
370 new_stat->nid_proc = lprocfs_register(nidstr,
371 obd->obd_proc_exports_entry,
374 if (IS_ERR(new_stat->nid_proc)) {
375 rc = PTR_ERR(new_stat->nid_proc);
376 new_stat->nid_proc = NULL;
377 CERROR("%s: cannot create proc entry for export %s: rc = %d\n",
378 obd->obd_name, nidstr, rc);
379 GOTO(destroy_new_ns, rc);
382 entry = lprocfs_add_simple(new_stat->nid_proc, "nodemap", new_stat,
383 &lprocfs_exp_nodemap_fops);
386 CWARN("Error adding the nodemap file: rc = %d\n", rc);
387 GOTO(destroy_new_ns, rc);
390 entry = lprocfs_add_simple(new_stat->nid_proc, "uuid", new_stat,
391 &lprocfs_exp_uuid_fops);
394 CWARN("Error adding the NID stats file: rc = %d\n", rc);
395 GOTO(destroy_new_ns, rc);
398 entry = lprocfs_add_simple(new_stat->nid_proc, "hash", new_stat,
399 &lprocfs_exp_hash_fops);
402 CWARN("Error adding the hash file: rc = %d\n", rc);
403 GOTO(destroy_new_ns, rc);
406 entry = lprocfs_add_simple(new_stat->nid_proc, "reply_data", new_stat,
407 &lprocfs_exp_replydata_fops);
410 CWARN("%s: Error adding the reply_data file: rc = %d\n",
412 GOTO(destroy_new_ns, rc);
415 spin_lock(&exp->exp_lock);
416 exp->exp_nid_stats = new_stat;
417 spin_unlock(&exp->exp_lock);
419 /* protect competitive add to list, not need locking on destroy */
420 spin_lock(&obd->obd_nid_lock);
421 list_add(&new_stat->nid_list, &obd->obd_nid_stats);
422 spin_unlock(&obd->obd_nid_lock);
427 if (new_stat->nid_proc != NULL)
428 lprocfs_remove(&new_stat->nid_proc);
429 cfs_hash_del(obd->obd_nid_stats_hash, nid, &new_stat->nid_hash);
432 nidstat_putref(new_stat);
433 OBD_FREE_PTR(new_stat);
436 EXPORT_SYMBOL(lprocfs_exp_setup);
438 int lprocfs_exp_cleanup(struct obd_export *exp)
440 struct nid_stat *stat = exp->exp_nid_stats;
442 if (!stat || !exp->exp_obd)
445 nidstat_putref(exp->exp_nid_stats);
446 exp->exp_nid_stats = NULL;
451 #define LPROCFS_OBD_OP_INIT(base, stats, op) \
453 unsigned int coffset = base + OBD_COUNTER_OFFSET(op); \
454 LASSERT(coffset < stats->ls_num); \
455 lprocfs_counter_init(stats, coffset, 0, #op, "reqs"); \
458 void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats)
460 LPROCFS_OBD_OP_INIT(num_private_stats, stats, iocontrol);
461 LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_info);
462 LPROCFS_OBD_OP_INIT(num_private_stats, stats, set_info_async);
463 LPROCFS_OBD_OP_INIT(num_private_stats, stats, setup);
464 LPROCFS_OBD_OP_INIT(num_private_stats, stats, precleanup);
465 LPROCFS_OBD_OP_INIT(num_private_stats, stats, cleanup);
466 LPROCFS_OBD_OP_INIT(num_private_stats, stats, process_config);
467 LPROCFS_OBD_OP_INIT(num_private_stats, stats, postrecov);
468 LPROCFS_OBD_OP_INIT(num_private_stats, stats, add_conn);
469 LPROCFS_OBD_OP_INIT(num_private_stats, stats, del_conn);
470 LPROCFS_OBD_OP_INIT(num_private_stats, stats, connect);
471 LPROCFS_OBD_OP_INIT(num_private_stats, stats, reconnect);
472 LPROCFS_OBD_OP_INIT(num_private_stats, stats, disconnect);
473 LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_init);
474 LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_fini);
475 LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_alloc);
476 LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs);
477 LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs_async);
478 LPROCFS_OBD_OP_INIT(num_private_stats, stats, create);
479 LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy);
480 LPROCFS_OBD_OP_INIT(num_private_stats, stats, setattr);
481 LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr);
482 LPROCFS_OBD_OP_INIT(num_private_stats, stats, preprw);
483 LPROCFS_OBD_OP_INIT(num_private_stats, stats, commitrw);
484 LPROCFS_OBD_OP_INIT(num_private_stats, stats, init_export);
485 LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy_export);
486 LPROCFS_OBD_OP_INIT(num_private_stats, stats, import_event);
487 LPROCFS_OBD_OP_INIT(num_private_stats, stats, notify);
488 LPROCFS_OBD_OP_INIT(num_private_stats, stats, health_check);
489 LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_uuid);
490 LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotactl);
491 LPROCFS_OBD_OP_INIT(num_private_stats, stats, ping);
492 LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_new);
493 LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_rem);
494 LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_add);
495 LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_del);
496 LPROCFS_OBD_OP_INIT(num_private_stats, stats, getref);
497 LPROCFS_OBD_OP_INIT(num_private_stats, stats, putref);
499 CLASSERT(NUM_OBD_STATS == OBD_COUNTER_OFFSET(putref) + 1);
501 EXPORT_SYMBOL(lprocfs_init_ops_stats);
503 int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats)
505 struct lprocfs_stats *stats;
506 unsigned int num_stats;
509 LASSERT(obd->obd_stats == NULL);
510 LASSERT(obd->obd_proc_entry != NULL);
511 LASSERT(obd->obd_cntr_base == 0);
513 num_stats = NUM_OBD_STATS + num_private_stats;
514 stats = lprocfs_alloc_stats(num_stats, 0);
518 lprocfs_init_ops_stats(num_private_stats, stats);
520 for (i = num_private_stats; i < num_stats; i++) {
521 /* If this LBUGs, it is likely that an obd
522 * operation was added to struct obd_ops in
523 * <obd.h>, and that the corresponding line item
524 * LPROCFS_OBD_OP_INIT(.., .., opname)
525 * is missing from the list above. */
526 LASSERTF(stats->ls_cnt_header[i].lc_name != NULL,
527 "Missing obd_stat initializer obd_op "
528 "operation at offset %d.\n", i - num_private_stats);
530 rc = lprocfs_register_stats(obd->obd_proc_entry, "stats", stats);
532 lprocfs_free_stats(&stats);
534 obd->obd_stats = stats;
535 obd->obd_cntr_base = num_private_stats;
539 EXPORT_SYMBOL(lprocfs_alloc_obd_stats);
541 void lprocfs_free_obd_stats(struct obd_device *obd)
544 lprocfs_free_stats(&obd->obd_stats);
546 EXPORT_SYMBOL(lprocfs_free_obd_stats);
548 int lprocfs_hash_seq_show(struct seq_file *m, void *data)
550 struct obd_device *obd = m->private;
556 c += cfs_hash_debug_header(m);
557 c += cfs_hash_debug_str(obd->obd_uuid_hash, m);
558 c += cfs_hash_debug_str(obd->obd_nid_hash, m);
559 c += cfs_hash_debug_str(obd->obd_nid_stats_hash, m);
562 EXPORT_SYMBOL(lprocfs_hash_seq_show);
564 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data)
566 struct obd_device *obd = m->private;
568 LASSERT(obd != NULL);
570 seq_printf(m, "status: ");
571 if (obd->obd_max_recoverable_clients == 0) {
572 seq_printf(m, "INACTIVE\n");
576 /* sampled unlocked, but really... */
577 if (obd->obd_recovering == 0) {
578 seq_printf(m, "COMPLETE\n");
579 seq_printf(m, "recovery_start: %lu\n", obd->obd_recovery_start);
580 seq_printf(m, "recovery_duration: %lu\n",
581 obd->obd_recovery_end - obd->obd_recovery_start);
582 /* Number of clients that have completed recovery */
583 seq_printf(m, "completed_clients: %d/%d\n",
584 obd->obd_max_recoverable_clients -
585 obd->obd_stale_clients,
586 obd->obd_max_recoverable_clients);
587 seq_printf(m, "replayed_requests: %d\n",
588 obd->obd_replayed_requests);
589 seq_printf(m, "last_transno: "LPD64"\n",
590 obd->obd_next_recovery_transno - 1);
591 seq_printf(m, "VBR: %s\n", obd->obd_version_recov ?
592 "ENABLED" : "DISABLED");
593 seq_printf(m, "IR: %s\n", obd->obd_no_ir ?
594 "DISABLED" : "ENABLED");
598 seq_printf(m, "RECOVERING\n");
599 seq_printf(m, "recovery_start: %lu\n", obd->obd_recovery_start);
600 seq_printf(m, "time_remaining: %lu\n",
601 cfs_time_current_sec() >=
602 obd->obd_recovery_start +
603 obd->obd_recovery_timeout ? 0 :
604 obd->obd_recovery_start +
605 obd->obd_recovery_timeout -
606 cfs_time_current_sec());
607 seq_printf(m, "connected_clients: %d/%d\n",
608 atomic_read(&obd->obd_connected_clients),
609 obd->obd_max_recoverable_clients);
610 /* Number of clients that have completed recovery */
611 seq_printf(m, "req_replay_clients: %d\n",
612 atomic_read(&obd->obd_req_replay_clients));
613 seq_printf(m, "lock_repay_clients: %d\n",
614 atomic_read(&obd->obd_lock_replay_clients));
615 seq_printf(m, "completed_clients: %d\n",
616 atomic_read(&obd->obd_connected_clients) -
617 atomic_read(&obd->obd_lock_replay_clients));
618 seq_printf(m, "evicted_clients: %d\n", obd->obd_stale_clients);
619 seq_printf(m, "replayed_requests: %d\n", obd->obd_replayed_requests);
620 seq_printf(m, "queued_requests: %d\n",
621 obd->obd_requests_queued_for_recovery);
622 seq_printf(m, "next_transno: "LPD64"\n",
623 obd->obd_next_recovery_transno);
627 EXPORT_SYMBOL(lprocfs_recovery_status_seq_show);
629 int lprocfs_ir_factor_seq_show(struct seq_file *m, void *data)
631 struct obd_device *obd = m->private;
633 LASSERT(obd != NULL);
634 return seq_printf(m, "%d\n", obd->obd_recovery_ir_factor);
636 EXPORT_SYMBOL(lprocfs_ir_factor_seq_show);
639 lprocfs_ir_factor_seq_write(struct file *file, const char __user *buffer,
640 size_t count, loff_t *off)
642 struct seq_file *m = file->private_data;
643 struct obd_device *obd = m->private;
646 LASSERT(obd != NULL);
647 rc = lprocfs_write_helper(buffer, count, &val);
651 if (val < OBD_IR_FACTOR_MIN || val > OBD_IR_FACTOR_MAX)
654 obd->obd_recovery_ir_factor = val;
657 EXPORT_SYMBOL(lprocfs_ir_factor_seq_write);
659 int lprocfs_recovery_time_soft_seq_show(struct seq_file *m, void *data)
661 struct obd_device *obd = m->private;
663 LASSERT(obd != NULL);
664 return seq_printf(m, "%d\n", obd->obd_recovery_timeout);
666 EXPORT_SYMBOL(lprocfs_recovery_time_soft_seq_show);
669 lprocfs_recovery_time_soft_seq_write(struct file *file,
670 const char __user *buffer,
671 size_t count, loff_t *off)
673 struct seq_file *m = file->private_data;
674 struct obd_device *obd = m->private;
677 LASSERT(obd != NULL);
678 rc = lprocfs_write_helper(buffer, count, &val);
682 obd->obd_recovery_timeout = val;
685 EXPORT_SYMBOL(lprocfs_recovery_time_soft_seq_write);
687 int lprocfs_recovery_time_hard_seq_show(struct seq_file *m, void *data)
689 struct obd_device *obd = m->private;
691 LASSERT(obd != NULL);
692 return seq_printf(m, "%u\n", obd->obd_recovery_time_hard);
694 EXPORT_SYMBOL(lprocfs_recovery_time_hard_seq_show);
697 lprocfs_recovery_time_hard_seq_write(struct file *file,
698 const char __user *buffer,
699 size_t count, loff_t *off)
701 struct seq_file *m = file->private_data;
702 struct obd_device *obd = m->private;
705 LASSERT(obd != NULL);
706 rc = lprocfs_write_helper(buffer, count, &val);
710 obd->obd_recovery_time_hard = val;
713 EXPORT_SYMBOL(lprocfs_recovery_time_hard_seq_write);
715 int lprocfs_target_instance_seq_show(struct seq_file *m, void *data)
717 struct obd_device *obd = m->private;
718 struct obd_device_target *target = &obd->u.obt;
720 LASSERT(obd != NULL);
721 LASSERT(target->obt_magic == OBT_MAGIC);
722 return seq_printf(m, "%u\n", obd->u.obt.obt_instance);
724 EXPORT_SYMBOL(lprocfs_target_instance_seq_show);
726 #endif /* CONFIG_PROC_FS*/