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
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2013, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 #define DEBUG_SUBSYSTEM S_CLASS
38 #include <linux/version.h>
39 #include <asm/statfs.h>
40 #include <obd_cksum.h>
41 #include <obd_class.h>
42 #include <lprocfs_status.h>
43 #include <linux/seq_file.h>
44 #include "osc_internal.h"
47 static int osc_active_seq_show(struct seq_file *m, void *v)
49 struct obd_device *dev = m->private;
52 LPROCFS_CLIMP_CHECK(dev);
53 rc = seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
54 LPROCFS_CLIMP_EXIT(dev);
58 static ssize_t osc_active_seq_write(struct file *file, const char *buffer,
59 size_t count, loff_t *off)
61 struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
64 rc = lprocfs_write_helper(buffer, count, &val);
67 if (val < 0 || val > 1)
71 if (dev->u.cli.cl_import->imp_deactive == val)
72 rc = ptlrpc_set_import_active(dev->u.cli.cl_import, val);
74 CDEBUG(D_CONFIG, "activate %d: ignoring repeat request\n", val);
78 LPROC_SEQ_FOPS(osc_active);
80 static int osc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
82 struct obd_device *dev = m->private;
83 struct client_obd *cli = &dev->u.cli;
86 client_obd_list_lock(&cli->cl_loi_list_lock);
87 rc = seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight);
88 client_obd_list_unlock(&cli->cl_loi_list_lock);
92 static ssize_t osc_max_rpcs_in_flight_seq_write(struct file *file,
94 size_t count, loff_t *off)
96 struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
97 struct client_obd *cli = &dev->u.cli;
98 struct ptlrpc_request_pool *pool = cli->cl_import->imp_rq_pool;
101 rc = lprocfs_write_helper(buffer, count, &val);
105 if (val < 1 || val > OSC_MAX_RIF_MAX)
108 LPROCFS_CLIMP_CHECK(dev);
109 if (pool && val > cli->cl_max_rpcs_in_flight)
110 pool->prp_populate(pool, val-cli->cl_max_rpcs_in_flight);
112 client_obd_list_lock(&cli->cl_loi_list_lock);
113 cli->cl_max_rpcs_in_flight = val;
114 client_adjust_max_dirty(cli);
115 client_obd_list_unlock(&cli->cl_loi_list_lock);
117 LPROCFS_CLIMP_EXIT(dev);
120 LPROC_SEQ_FOPS(osc_max_rpcs_in_flight);
122 static int osc_max_dirty_mb_seq_show(struct seq_file *m, void *v)
124 struct obd_device *dev = m->private;
125 struct client_obd *cli = &dev->u.cli;
129 client_obd_list_lock(&cli->cl_loi_list_lock);
130 val = cli->cl_dirty_max_pages;
131 client_obd_list_unlock(&cli->cl_loi_list_lock);
133 mult = 1 << (20 - PAGE_CACHE_SHIFT);
134 return lprocfs_seq_read_frac_helper(m, val, mult);
137 static ssize_t osc_max_dirty_mb_seq_write(struct file *file, const char *buffer,
138 size_t count, loff_t *off)
140 struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
141 struct client_obd *cli = &dev->u.cli;
142 int pages_number, mult, rc;
144 mult = 1 << (20 - PAGE_CACHE_SHIFT);
145 rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
149 if (pages_number <= 0 ||
150 pages_number > OSC_MAX_DIRTY_MB_MAX << (20 - PAGE_CACHE_SHIFT) ||
151 pages_number > totalram_pages / 4) /* 1/4 of RAM */
154 client_obd_list_lock(&cli->cl_loi_list_lock);
155 cli->cl_dirty_max_pages = pages_number;
156 osc_wake_cache_waiters(cli);
157 client_obd_list_unlock(&cli->cl_loi_list_lock);
161 LPROC_SEQ_FOPS(osc_max_dirty_mb);
163 static int osc_cached_mb_seq_show(struct seq_file *m, void *v)
165 struct obd_device *dev = m->private;
166 struct client_obd *cli = &dev->u.cli;
167 int shift = 20 - PAGE_CACHE_SHIFT;
173 (atomic_long_read(&cli->cl_lru_in_list) +
174 atomic_long_read(&cli->cl_lru_busy)) >> shift,
175 atomic_long_read(&cli->cl_lru_busy));
180 /* shrink the number of caching pages to a specific number */
182 osc_cached_mb_seq_write(struct file *file, const char __user *buffer,
183 size_t count, loff_t *off)
185 struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
186 struct client_obd *cli = &dev->u.cli;
193 if (count >= sizeof(kernbuf))
196 if (copy_from_user(kernbuf, buffer, count))
200 mult = 1 << (20 - PAGE_CACHE_SHIFT);
201 buffer += lprocfs_find_named_value(kernbuf, "used_mb:", &count) -
203 rc = lprocfs_write_frac_u64_helper(buffer, count, &val, mult);
210 pages_number = (long)val;
212 if (pages_number < 0)
215 rc = atomic_long_read(&cli->cl_lru_in_list) - pages_number;
220 env = cl_env_get(&refcheck);
222 (void)osc_lru_shrink(env, cli, rc, true);
223 cl_env_put(env, &refcheck);
229 LPROC_SEQ_FOPS(osc_cached_mb);
231 static int osc_cur_dirty_bytes_seq_show(struct seq_file *m, void *v)
233 struct obd_device *dev = m->private;
234 struct client_obd *cli = &dev->u.cli;
237 client_obd_list_lock(&cli->cl_loi_list_lock);
238 rc = seq_printf(m, "%lu\n", cli->cl_dirty_pages << PAGE_CACHE_SHIFT);
239 client_obd_list_unlock(&cli->cl_loi_list_lock);
242 LPROC_SEQ_FOPS_RO(osc_cur_dirty_bytes);
244 static int osc_cur_grant_bytes_seq_show(struct seq_file *m, void *v)
246 struct obd_device *dev = m->private;
247 struct client_obd *cli = &dev->u.cli;
250 client_obd_list_lock(&cli->cl_loi_list_lock);
251 rc = seq_printf(m, "%lu\n", cli->cl_avail_grant);
252 client_obd_list_unlock(&cli->cl_loi_list_lock);
256 static ssize_t osc_cur_grant_bytes_seq_write(struct file *file, const char *buffer,
257 size_t count, loff_t *off)
259 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
260 struct client_obd *cli = &obd->u.cli;
267 rc = lprocfs_write_u64_helper(buffer, count, &val);
271 /* this is only for shrinking grant */
272 client_obd_list_lock(&cli->cl_loi_list_lock);
273 if (val >= cli->cl_avail_grant) {
274 client_obd_list_unlock(&cli->cl_loi_list_lock);
277 client_obd_list_unlock(&cli->cl_loi_list_lock);
279 LPROCFS_CLIMP_CHECK(obd);
280 if (cli->cl_import->imp_state == LUSTRE_IMP_FULL)
281 rc = osc_shrink_grant_to_target(cli, val);
282 LPROCFS_CLIMP_EXIT(obd);
287 LPROC_SEQ_FOPS(osc_cur_grant_bytes);
289 static int osc_cur_lost_grant_bytes_seq_show(struct seq_file *m, void *v)
291 struct obd_device *dev = m->private;
292 struct client_obd *cli = &dev->u.cli;
295 client_obd_list_lock(&cli->cl_loi_list_lock);
296 rc = seq_printf(m, "%lu\n", cli->cl_lost_grant);
297 client_obd_list_unlock(&cli->cl_loi_list_lock);
300 LPROC_SEQ_FOPS_RO(osc_cur_lost_grant_bytes);
302 static int osc_grant_shrink_interval_seq_show(struct seq_file *m, void *v)
304 struct obd_device *obd = m->private;
308 return seq_printf(m, "%d\n",
309 obd->u.cli.cl_grant_shrink_interval);
312 static ssize_t osc_grant_shrink_interval_seq_write(struct file *file,
314 size_t count, loff_t *off)
316 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
322 rc = lprocfs_write_helper(buffer, count, &val);
329 obd->u.cli.cl_grant_shrink_interval = val;
333 LPROC_SEQ_FOPS(osc_grant_shrink_interval);
335 static int osc_checksum_seq_show(struct seq_file *m, void *v)
337 struct obd_device *obd = m->private;
342 return seq_printf(m, "%d\n",
343 obd->u.cli.cl_checksum ? 1 : 0);
346 static ssize_t osc_checksum_seq_write(struct file *file, const char *buffer,
347 size_t count, loff_t *off)
349 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
355 rc = lprocfs_write_helper(buffer, count, &val);
359 obd->u.cli.cl_checksum = (val ? 1 : 0);
363 LPROC_SEQ_FOPS(osc_checksum);
365 static int osc_checksum_type_seq_show(struct seq_file *m, void *v)
367 struct obd_device *obd = m->private;
374 for (i = 0; i < ARRAY_SIZE(cksum_name); i++) {
375 if (((1 << i) & obd->u.cli.cl_supp_cksum_types) == 0)
377 if (obd->u.cli.cl_cksum_type == (1 << i))
378 seq_printf(m, "[%s] ", cksum_name[i]);
380 seq_printf(m, "%s ", cksum_name[i]);
386 static ssize_t osc_checksum_type_seq_write(struct file *file, const char *buffer,
387 size_t count, loff_t *off)
389 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
397 if (count > sizeof(kernbuf) - 1)
399 if (copy_from_user(kernbuf, buffer, count))
401 if (count > 0 && kernbuf[count - 1] == '\n')
402 kernbuf[count - 1] = '\0';
404 kernbuf[count] = '\0';
406 for (i = 0; i < ARRAY_SIZE(cksum_name); i++) {
407 if (((1 << i) & obd->u.cli.cl_supp_cksum_types) == 0)
409 if (!strcmp(kernbuf, cksum_name[i])) {
410 obd->u.cli.cl_cksum_type = 1 << i;
416 LPROC_SEQ_FOPS(osc_checksum_type);
418 static int osc_resend_count_seq_show(struct seq_file *m, void *v)
420 struct obd_device *obd = m->private;
422 return seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends));
425 static ssize_t osc_resend_count_seq_write(struct file *file, const char *buffer,
426 size_t count, loff_t *off)
428 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
431 rc = lprocfs_write_helper(buffer, count, &val);
438 atomic_set(&obd->u.cli.cl_resends, val);
442 LPROC_SEQ_FOPS(osc_resend_count);
444 static int osc_contention_seconds_seq_show(struct seq_file *m, void *v)
446 struct obd_device *obd = m->private;
447 struct osc_device *od = obd2osc_dev(obd);
449 return seq_printf(m, "%u\n", od->od_contention_time);
452 static ssize_t osc_contention_seconds_seq_write(struct file *file, const char *buffer,
453 size_t count, loff_t *off)
455 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
456 struct osc_device *od = obd2osc_dev(obd);
458 return lprocfs_write_helper(buffer, count, &od->od_contention_time) ?: count;
460 LPROC_SEQ_FOPS(osc_contention_seconds);
462 static int osc_lockless_truncate_seq_show(struct seq_file *m, void *v)
464 struct obd_device *obd = m->private;
465 struct osc_device *od = obd2osc_dev(obd);
467 return seq_printf(m, "%u\n", od->od_lockless_truncate);
470 static ssize_t osc_lockless_truncate_seq_write(struct file *file, const char *buffer,
471 size_t count, loff_t *off)
473 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
474 struct osc_device *od = obd2osc_dev(obd);
476 return lprocfs_write_helper(buffer, count, &od->od_lockless_truncate) ?:
479 LPROC_SEQ_FOPS(osc_lockless_truncate);
481 static int osc_destroys_in_flight_seq_show(struct seq_file *m, void *v)
483 struct obd_device *obd = m->private;
484 return seq_printf(m, "%u\n",
485 atomic_read(&obd->u.cli.cl_destroy_in_flight));
487 LPROC_SEQ_FOPS_RO(osc_destroys_in_flight);
489 static int osc_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *v)
491 return lprocfs_obd_max_pages_per_rpc_seq_show(m, m->private);
494 static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file,
496 size_t count, loff_t *off)
498 struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
499 struct client_obd *cli = &dev->u.cli;
500 struct obd_connect_data *ocd = &cli->cl_import->imp_connect_data;
504 rc = lprocfs_write_u64_helper(buffer, count, &val);
508 /* if the max_pages is specified in bytes, convert to pages */
509 if (val >= ONE_MB_BRW_SIZE)
510 val >>= PAGE_CACHE_SHIFT;
512 LPROCFS_CLIMP_CHECK(dev);
514 chunk_mask = ~((1 << (cli->cl_chunkbits - PAGE_CACHE_SHIFT)) - 1);
515 /* max_pages_per_rpc must be chunk aligned */
516 val = (val + ~chunk_mask) & chunk_mask;
517 if (val == 0 || val > ocd->ocd_brw_size >> PAGE_CACHE_SHIFT) {
518 LPROCFS_CLIMP_EXIT(dev);
521 client_obd_list_lock(&cli->cl_loi_list_lock);
522 cli->cl_max_pages_per_rpc = val;
523 client_adjust_max_dirty(cli);
524 client_obd_list_unlock(&cli->cl_loi_list_lock);
526 LPROCFS_CLIMP_EXIT(dev);
529 LPROC_SEQ_FOPS(osc_obd_max_pages_per_rpc);
531 static int osc_unstable_stats_seq_show(struct seq_file *m, void *v)
533 struct obd_device *dev = m->private;
534 struct client_obd *cli = &dev->u.cli;
538 pages = atomic_long_read(&cli->cl_unstable_count);
539 mb = (pages * PAGE_CACHE_SIZE) >> 20;
541 return seq_printf(m, "unstable_pages: %20ld\n"
542 "unstable_mb: %10d\n",
545 LPROC_SEQ_FOPS_RO(osc_unstable_stats);
547 LPROC_SEQ_FOPS_RO_TYPE(osc, uuid);
548 LPROC_SEQ_FOPS_RO_TYPE(osc, connect_flags);
549 LPROC_SEQ_FOPS_RO_TYPE(osc, blksize);
550 LPROC_SEQ_FOPS_RO_TYPE(osc, kbytestotal);
551 LPROC_SEQ_FOPS_RO_TYPE(osc, kbytesfree);
552 LPROC_SEQ_FOPS_RO_TYPE(osc, kbytesavail);
553 LPROC_SEQ_FOPS_RO_TYPE(osc, filestotal);
554 LPROC_SEQ_FOPS_RO_TYPE(osc, filesfree);
555 LPROC_SEQ_FOPS_RO_TYPE(osc, server_uuid);
556 LPROC_SEQ_FOPS_RO_TYPE(osc, conn_uuid);
557 LPROC_SEQ_FOPS_RO_TYPE(osc, timeouts);
558 LPROC_SEQ_FOPS_RO_TYPE(osc, state);
560 LPROC_SEQ_FOPS_WO_TYPE(osc, ping);
562 LPROC_SEQ_FOPS_RW_TYPE(osc, import);
563 LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov);
565 struct lprocfs_seq_vars lprocfs_osc_obd_vars[] = {
567 .fops = &osc_uuid_fops },
569 .fops = &osc_ping_fops,
571 { .name = "connect_flags",
572 .fops = &osc_connect_flags_fops },
573 { .name = "blocksize",
574 .fops = &osc_blksize_fops },
575 { .name = "kbytestotal",
576 .fops = &osc_kbytestotal_fops },
577 { .name = "kbytesfree",
578 .fops = &osc_kbytesfree_fops },
579 { .name = "kbytesavail",
580 .fops = &osc_kbytesavail_fops },
581 { .name = "filestotal",
582 .fops = &osc_filestotal_fops },
583 { .name = "filesfree",
584 .fops = &osc_filesfree_fops },
585 { .name = "ost_server_uuid",
586 .fops = &osc_server_uuid_fops },
587 { .name = "ost_conn_uuid",
588 .fops = &osc_conn_uuid_fops },
590 .fops = &osc_active_fops },
591 { .name = "max_pages_per_rpc",
592 .fops = &osc_obd_max_pages_per_rpc_fops },
593 { .name = "max_rpcs_in_flight",
594 .fops = &osc_max_rpcs_in_flight_fops },
595 { .name = "destroys_in_flight",
596 .fops = &osc_destroys_in_flight_fops },
597 { .name = "max_dirty_mb",
598 .fops = &osc_max_dirty_mb_fops },
599 { .name = "osc_cached_mb",
600 .fops = &osc_cached_mb_fops },
601 { .name = "cur_dirty_bytes",
602 .fops = &osc_cur_dirty_bytes_fops },
603 { .name = "cur_grant_bytes",
604 .fops = &osc_cur_grant_bytes_fops },
605 { .name = "cur_lost_grant_bytes",
606 .fops = &osc_cur_lost_grant_bytes_fops },
607 { .name = "grant_shrink_interval",
608 .fops = &osc_grant_shrink_interval_fops },
609 { .name = "checksums",
610 .fops = &osc_checksum_fops },
611 { .name = "checksum_type",
612 .fops = &osc_checksum_type_fops },
613 { .name = "resend_count",
614 .fops = &osc_resend_count_fops },
615 { .name = "timeouts",
616 .fops = &osc_timeouts_fops },
617 { .name = "contention_seconds",
618 .fops = &osc_contention_seconds_fops },
619 { .name = "lockless_truncate",
620 .fops = &osc_lockless_truncate_fops },
622 .fops = &osc_import_fops },
624 .fops = &osc_state_fops },
625 { .name = "pinger_recov",
626 .fops = &osc_pinger_recov_fops },
627 { .name = "unstable_stats",
628 .fops = &osc_unstable_stats_fops },
632 #define pct(a,b) (b ? a * 100 / b : 0)
634 static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
637 struct obd_device *dev = seq->private;
638 struct client_obd *cli = &dev->u.cli;
639 unsigned long read_tot = 0, write_tot = 0, read_cum, write_cum;
642 do_gettimeofday(&now);
644 client_obd_list_lock(&cli->cl_loi_list_lock);
646 seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
647 now.tv_sec, now.tv_usec);
648 seq_printf(seq, "read RPCs in flight: %d\n",
649 cli->cl_r_in_flight);
650 seq_printf(seq, "write RPCs in flight: %d\n",
651 cli->cl_w_in_flight);
652 seq_printf(seq, "pending write pages: %d\n",
653 atomic_read(&cli->cl_pending_w_pages));
654 seq_printf(seq, "pending read pages: %d\n",
655 atomic_read(&cli->cl_pending_r_pages));
657 seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
658 seq_printf(seq, "pages per rpc rpcs %% cum %% |");
659 seq_printf(seq, " rpcs %% cum %%\n");
661 read_tot = lprocfs_oh_sum(&cli->cl_read_page_hist);
662 write_tot = lprocfs_oh_sum(&cli->cl_write_page_hist);
666 for (i = 0; i < OBD_HIST_MAX; i++) {
667 unsigned long r = cli->cl_read_page_hist.oh_buckets[i];
668 unsigned long w = cli->cl_write_page_hist.oh_buckets[i];
672 seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
673 1 << i, r, pct(r, read_tot),
674 pct(read_cum, read_tot), w,
676 pct(write_cum, write_tot));
677 if (read_cum == read_tot && write_cum == write_tot)
681 seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
682 seq_printf(seq, "rpcs in flight rpcs %% cum %% |");
683 seq_printf(seq, " rpcs %% cum %%\n");
685 read_tot = lprocfs_oh_sum(&cli->cl_read_rpc_hist);
686 write_tot = lprocfs_oh_sum(&cli->cl_write_rpc_hist);
690 for (i = 0; i < OBD_HIST_MAX; i++) {
691 unsigned long r = cli->cl_read_rpc_hist.oh_buckets[i];
692 unsigned long w = cli->cl_write_rpc_hist.oh_buckets[i];
695 seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
696 i, r, pct(r, read_tot),
697 pct(read_cum, read_tot), w,
699 pct(write_cum, write_tot));
700 if (read_cum == read_tot && write_cum == write_tot)
704 seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
705 seq_printf(seq, "offset rpcs %% cum %% |");
706 seq_printf(seq, " rpcs %% cum %%\n");
708 read_tot = lprocfs_oh_sum(&cli->cl_read_offset_hist);
709 write_tot = lprocfs_oh_sum(&cli->cl_write_offset_hist);
713 for (i = 0; i < OBD_HIST_MAX; i++) {
714 unsigned long r = cli->cl_read_offset_hist.oh_buckets[i];
715 unsigned long w = cli->cl_write_offset_hist.oh_buckets[i];
718 seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
719 (i == 0) ? 0 : 1 << (i - 1),
720 r, pct(r, read_tot), pct(read_cum, read_tot),
721 w, pct(w, write_tot), pct(write_cum, write_tot));
722 if (read_cum == read_tot && write_cum == write_tot)
726 client_obd_list_unlock(&cli->cl_loi_list_lock);
732 static ssize_t osc_rpc_stats_seq_write(struct file *file, const char *buf,
733 size_t len, loff_t *off)
735 struct seq_file *seq = file->private_data;
736 struct obd_device *dev = seq->private;
737 struct client_obd *cli = &dev->u.cli;
739 lprocfs_oh_clear(&cli->cl_read_rpc_hist);
740 lprocfs_oh_clear(&cli->cl_write_rpc_hist);
741 lprocfs_oh_clear(&cli->cl_read_page_hist);
742 lprocfs_oh_clear(&cli->cl_write_page_hist);
743 lprocfs_oh_clear(&cli->cl_read_offset_hist);
744 lprocfs_oh_clear(&cli->cl_write_offset_hist);
748 LPROC_SEQ_FOPS(osc_rpc_stats);
750 static int osc_stats_seq_show(struct seq_file *seq, void *v)
753 struct obd_device *dev = seq->private;
754 struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
756 do_gettimeofday(&now);
758 seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
759 now.tv_sec, now.tv_usec);
760 seq_printf(seq, "lockless_write_bytes\t\t"LPU64"\n",
761 stats->os_lockless_writes);
762 seq_printf(seq, "lockless_read_bytes\t\t"LPU64"\n",
763 stats->os_lockless_reads);
764 seq_printf(seq, "lockless_truncate\t\t"LPU64"\n",
765 stats->os_lockless_truncates);
769 static ssize_t osc_stats_seq_write(struct file *file, const char *buf,
770 size_t len, loff_t *off)
772 struct seq_file *seq = file->private_data;
773 struct obd_device *dev = seq->private;
774 struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
776 memset(stats, 0, sizeof(*stats));
780 LPROC_SEQ_FOPS(osc_stats);
782 int lproc_osc_attach_seqstat(struct obd_device *dev)
786 rc = lprocfs_seq_create(dev->obd_proc_entry, "osc_stats", 0644,
787 &osc_stats_fops, dev);
789 rc = lprocfs_obd_seq_create(dev, "rpc_stats", 0644,
790 &osc_rpc_stats_fops, dev);