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_read(&cli->cl_lru_in_list) +
174 atomic_read(&cli->cl_lru_busy)) >> shift,
175 atomic_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;
187 int pages_number, mult, rc;
190 if (count >= sizeof(kernbuf))
193 if (copy_from_user(kernbuf, buffer, count))
197 mult = 1 << (20 - PAGE_CACHE_SHIFT);
198 buffer += lprocfs_find_named_value(kernbuf, "used_mb:", &count) -
200 rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
204 if (pages_number < 0)
207 rc = atomic_read(&cli->cl_lru_in_list) - pages_number;
212 env = cl_env_get(&refcheck);
214 (void)osc_lru_shrink(env, cli, rc, true);
215 cl_env_put(env, &refcheck);
221 LPROC_SEQ_FOPS(osc_cached_mb);
223 static int osc_cur_dirty_bytes_seq_show(struct seq_file *m, void *v)
225 struct obd_device *dev = m->private;
226 struct client_obd *cli = &dev->u.cli;
229 client_obd_list_lock(&cli->cl_loi_list_lock);
230 rc = seq_printf(m, "%lu\n", cli->cl_dirty_pages << PAGE_CACHE_SHIFT);
231 client_obd_list_unlock(&cli->cl_loi_list_lock);
234 LPROC_SEQ_FOPS_RO(osc_cur_dirty_bytes);
236 static int osc_cur_grant_bytes_seq_show(struct seq_file *m, void *v)
238 struct obd_device *dev = m->private;
239 struct client_obd *cli = &dev->u.cli;
242 client_obd_list_lock(&cli->cl_loi_list_lock);
243 rc = seq_printf(m, "%lu\n", cli->cl_avail_grant);
244 client_obd_list_unlock(&cli->cl_loi_list_lock);
248 static ssize_t osc_cur_grant_bytes_seq_write(struct file *file, const char *buffer,
249 size_t count, loff_t *off)
251 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
252 struct client_obd *cli = &obd->u.cli;
259 rc = lprocfs_write_u64_helper(buffer, count, &val);
263 /* this is only for shrinking grant */
264 client_obd_list_lock(&cli->cl_loi_list_lock);
265 if (val >= cli->cl_avail_grant) {
266 client_obd_list_unlock(&cli->cl_loi_list_lock);
269 client_obd_list_unlock(&cli->cl_loi_list_lock);
271 LPROCFS_CLIMP_CHECK(obd);
272 if (cli->cl_import->imp_state == LUSTRE_IMP_FULL)
273 rc = osc_shrink_grant_to_target(cli, val);
274 LPROCFS_CLIMP_EXIT(obd);
279 LPROC_SEQ_FOPS(osc_cur_grant_bytes);
281 static int osc_cur_lost_grant_bytes_seq_show(struct seq_file *m, void *v)
283 struct obd_device *dev = m->private;
284 struct client_obd *cli = &dev->u.cli;
287 client_obd_list_lock(&cli->cl_loi_list_lock);
288 rc = seq_printf(m, "%lu\n", cli->cl_lost_grant);
289 client_obd_list_unlock(&cli->cl_loi_list_lock);
292 LPROC_SEQ_FOPS_RO(osc_cur_lost_grant_bytes);
294 static int osc_grant_shrink_interval_seq_show(struct seq_file *m, void *v)
296 struct obd_device *obd = m->private;
300 return seq_printf(m, "%d\n",
301 obd->u.cli.cl_grant_shrink_interval);
304 static ssize_t osc_grant_shrink_interval_seq_write(struct file *file,
306 size_t count, loff_t *off)
308 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
314 rc = lprocfs_write_helper(buffer, count, &val);
321 obd->u.cli.cl_grant_shrink_interval = val;
325 LPROC_SEQ_FOPS(osc_grant_shrink_interval);
327 static int osc_checksum_seq_show(struct seq_file *m, void *v)
329 struct obd_device *obd = m->private;
334 return seq_printf(m, "%d\n",
335 obd->u.cli.cl_checksum ? 1 : 0);
338 static ssize_t osc_checksum_seq_write(struct file *file, const char *buffer,
339 size_t count, loff_t *off)
341 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
347 rc = lprocfs_write_helper(buffer, count, &val);
351 obd->u.cli.cl_checksum = (val ? 1 : 0);
355 LPROC_SEQ_FOPS(osc_checksum);
357 static int osc_checksum_type_seq_show(struct seq_file *m, void *v)
359 struct obd_device *obd = m->private;
366 for (i = 0; i < ARRAY_SIZE(cksum_name); i++) {
367 if (((1 << i) & obd->u.cli.cl_supp_cksum_types) == 0)
369 if (obd->u.cli.cl_cksum_type == (1 << i))
370 seq_printf(m, "[%s] ", cksum_name[i]);
372 seq_printf(m, "%s ", cksum_name[i]);
378 static ssize_t osc_checksum_type_seq_write(struct file *file, const char *buffer,
379 size_t count, loff_t *off)
381 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
389 if (count > sizeof(kernbuf) - 1)
391 if (copy_from_user(kernbuf, buffer, count))
393 if (count > 0 && kernbuf[count - 1] == '\n')
394 kernbuf[count - 1] = '\0';
396 kernbuf[count] = '\0';
398 for (i = 0; i < ARRAY_SIZE(cksum_name); i++) {
399 if (((1 << i) & obd->u.cli.cl_supp_cksum_types) == 0)
401 if (!strcmp(kernbuf, cksum_name[i])) {
402 obd->u.cli.cl_cksum_type = 1 << i;
408 LPROC_SEQ_FOPS(osc_checksum_type);
410 static int osc_resend_count_seq_show(struct seq_file *m, void *v)
412 struct obd_device *obd = m->private;
414 return seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends));
417 static ssize_t osc_resend_count_seq_write(struct file *file, const char *buffer,
418 size_t count, loff_t *off)
420 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
423 rc = lprocfs_write_helper(buffer, count, &val);
430 atomic_set(&obd->u.cli.cl_resends, val);
434 LPROC_SEQ_FOPS(osc_resend_count);
436 static int osc_contention_seconds_seq_show(struct seq_file *m, void *v)
438 struct obd_device *obd = m->private;
439 struct osc_device *od = obd2osc_dev(obd);
441 return seq_printf(m, "%u\n", od->od_contention_time);
444 static ssize_t osc_contention_seconds_seq_write(struct file *file, const char *buffer,
445 size_t count, loff_t *off)
447 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
448 struct osc_device *od = obd2osc_dev(obd);
450 return lprocfs_write_helper(buffer, count, &od->od_contention_time) ?: count;
452 LPROC_SEQ_FOPS(osc_contention_seconds);
454 static int osc_lockless_truncate_seq_show(struct seq_file *m, void *v)
456 struct obd_device *obd = m->private;
457 struct osc_device *od = obd2osc_dev(obd);
459 return seq_printf(m, "%u\n", od->od_lockless_truncate);
462 static ssize_t osc_lockless_truncate_seq_write(struct file *file, const char *buffer,
463 size_t count, loff_t *off)
465 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
466 struct osc_device *od = obd2osc_dev(obd);
468 return lprocfs_write_helper(buffer, count, &od->od_lockless_truncate) ?:
471 LPROC_SEQ_FOPS(osc_lockless_truncate);
473 static int osc_destroys_in_flight_seq_show(struct seq_file *m, void *v)
475 struct obd_device *obd = m->private;
476 return seq_printf(m, "%u\n",
477 atomic_read(&obd->u.cli.cl_destroy_in_flight));
479 LPROC_SEQ_FOPS_RO(osc_destroys_in_flight);
481 static int osc_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *v)
483 return lprocfs_obd_max_pages_per_rpc_seq_show(m, m->private);
486 static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file,
488 size_t count, loff_t *off)
490 struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
491 struct client_obd *cli = &dev->u.cli;
492 struct obd_connect_data *ocd = &cli->cl_import->imp_connect_data;
496 rc = lprocfs_write_u64_helper(buffer, count, &val);
500 /* if the max_pages is specified in bytes, convert to pages */
501 if (val >= ONE_MB_BRW_SIZE)
502 val >>= PAGE_CACHE_SHIFT;
504 LPROCFS_CLIMP_CHECK(dev);
506 chunk_mask = ~((1 << (cli->cl_chunkbits - PAGE_CACHE_SHIFT)) - 1);
507 /* max_pages_per_rpc must be chunk aligned */
508 val = (val + ~chunk_mask) & chunk_mask;
509 if (val == 0 || val > ocd->ocd_brw_size >> PAGE_CACHE_SHIFT) {
510 LPROCFS_CLIMP_EXIT(dev);
513 client_obd_list_lock(&cli->cl_loi_list_lock);
514 cli->cl_max_pages_per_rpc = val;
515 client_adjust_max_dirty(cli);
516 client_obd_list_unlock(&cli->cl_loi_list_lock);
518 LPROCFS_CLIMP_EXIT(dev);
521 LPROC_SEQ_FOPS(osc_obd_max_pages_per_rpc);
523 static int osc_unstable_stats_seq_show(struct seq_file *m, void *v)
525 struct obd_device *dev = m->private;
526 struct client_obd *cli = &dev->u.cli;
529 pages = atomic_read(&cli->cl_unstable_count);
530 mb = (pages * PAGE_CACHE_SIZE) >> 20;
532 return seq_printf(m, "unstable_pages: %8d\n"
533 "unstable_mb: %8d\n",
536 LPROC_SEQ_FOPS_RO(osc_unstable_stats);
538 LPROC_SEQ_FOPS_RO_TYPE(osc, uuid);
539 LPROC_SEQ_FOPS_RO_TYPE(osc, connect_flags);
540 LPROC_SEQ_FOPS_RO_TYPE(osc, blksize);
541 LPROC_SEQ_FOPS_RO_TYPE(osc, kbytestotal);
542 LPROC_SEQ_FOPS_RO_TYPE(osc, kbytesfree);
543 LPROC_SEQ_FOPS_RO_TYPE(osc, kbytesavail);
544 LPROC_SEQ_FOPS_RO_TYPE(osc, filestotal);
545 LPROC_SEQ_FOPS_RO_TYPE(osc, filesfree);
546 LPROC_SEQ_FOPS_RO_TYPE(osc, server_uuid);
547 LPROC_SEQ_FOPS_RO_TYPE(osc, conn_uuid);
548 LPROC_SEQ_FOPS_RO_TYPE(osc, timeouts);
549 LPROC_SEQ_FOPS_RO_TYPE(osc, state);
551 LPROC_SEQ_FOPS_WO_TYPE(osc, ping);
553 LPROC_SEQ_FOPS_RW_TYPE(osc, import);
554 LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov);
556 struct lprocfs_seq_vars lprocfs_osc_obd_vars[] = {
558 .fops = &osc_uuid_fops },
560 .fops = &osc_ping_fops,
562 { .name = "connect_flags",
563 .fops = &osc_connect_flags_fops },
564 { .name = "blocksize",
565 .fops = &osc_blksize_fops },
566 { .name = "kbytestotal",
567 .fops = &osc_kbytestotal_fops },
568 { .name = "kbytesfree",
569 .fops = &osc_kbytesfree_fops },
570 { .name = "kbytesavail",
571 .fops = &osc_kbytesavail_fops },
572 { .name = "filestotal",
573 .fops = &osc_filestotal_fops },
574 { .name = "filesfree",
575 .fops = &osc_filesfree_fops },
576 { .name = "ost_server_uuid",
577 .fops = &osc_server_uuid_fops },
578 { .name = "ost_conn_uuid",
579 .fops = &osc_conn_uuid_fops },
581 .fops = &osc_active_fops },
582 { .name = "max_pages_per_rpc",
583 .fops = &osc_obd_max_pages_per_rpc_fops },
584 { .name = "max_rpcs_in_flight",
585 .fops = &osc_max_rpcs_in_flight_fops },
586 { .name = "destroys_in_flight",
587 .fops = &osc_destroys_in_flight_fops },
588 { .name = "max_dirty_mb",
589 .fops = &osc_max_dirty_mb_fops },
590 { .name = "osc_cached_mb",
591 .fops = &osc_cached_mb_fops },
592 { .name = "cur_dirty_bytes",
593 .fops = &osc_cur_dirty_bytes_fops },
594 { .name = "cur_grant_bytes",
595 .fops = &osc_cur_grant_bytes_fops },
596 { .name = "cur_lost_grant_bytes",
597 .fops = &osc_cur_lost_grant_bytes_fops },
598 { .name = "grant_shrink_interval",
599 .fops = &osc_grant_shrink_interval_fops },
600 { .name = "checksums",
601 .fops = &osc_checksum_fops },
602 { .name = "checksum_type",
603 .fops = &osc_checksum_type_fops },
604 { .name = "resend_count",
605 .fops = &osc_resend_count_fops },
606 { .name = "timeouts",
607 .fops = &osc_timeouts_fops },
608 { .name = "contention_seconds",
609 .fops = &osc_contention_seconds_fops },
610 { .name = "lockless_truncate",
611 .fops = &osc_lockless_truncate_fops },
613 .fops = &osc_import_fops },
615 .fops = &osc_state_fops },
616 { .name = "pinger_recov",
617 .fops = &osc_pinger_recov_fops },
618 { .name = "unstable_stats",
619 .fops = &osc_unstable_stats_fops },
623 #define pct(a,b) (b ? a * 100 / b : 0)
625 static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
628 struct obd_device *dev = seq->private;
629 struct client_obd *cli = &dev->u.cli;
630 unsigned long read_tot = 0, write_tot = 0, read_cum, write_cum;
633 do_gettimeofday(&now);
635 client_obd_list_lock(&cli->cl_loi_list_lock);
637 seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
638 now.tv_sec, now.tv_usec);
639 seq_printf(seq, "read RPCs in flight: %d\n",
640 cli->cl_r_in_flight);
641 seq_printf(seq, "write RPCs in flight: %d\n",
642 cli->cl_w_in_flight);
643 seq_printf(seq, "pending write pages: %d\n",
644 atomic_read(&cli->cl_pending_w_pages));
645 seq_printf(seq, "pending read pages: %d\n",
646 atomic_read(&cli->cl_pending_r_pages));
648 seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
649 seq_printf(seq, "pages per rpc rpcs %% cum %% |");
650 seq_printf(seq, " rpcs %% cum %%\n");
652 read_tot = lprocfs_oh_sum(&cli->cl_read_page_hist);
653 write_tot = lprocfs_oh_sum(&cli->cl_write_page_hist);
657 for (i = 0; i < OBD_HIST_MAX; i++) {
658 unsigned long r = cli->cl_read_page_hist.oh_buckets[i];
659 unsigned long w = cli->cl_write_page_hist.oh_buckets[i];
663 seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
664 1 << i, r, pct(r, read_tot),
665 pct(read_cum, read_tot), w,
667 pct(write_cum, write_tot));
668 if (read_cum == read_tot && write_cum == write_tot)
672 seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
673 seq_printf(seq, "rpcs in flight rpcs %% cum %% |");
674 seq_printf(seq, " rpcs %% cum %%\n");
676 read_tot = lprocfs_oh_sum(&cli->cl_read_rpc_hist);
677 write_tot = lprocfs_oh_sum(&cli->cl_write_rpc_hist);
681 for (i = 0; i < OBD_HIST_MAX; i++) {
682 unsigned long r = cli->cl_read_rpc_hist.oh_buckets[i];
683 unsigned long w = cli->cl_write_rpc_hist.oh_buckets[i];
686 seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
687 i, r, pct(r, read_tot),
688 pct(read_cum, read_tot), w,
690 pct(write_cum, write_tot));
691 if (read_cum == read_tot && write_cum == write_tot)
695 seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
696 seq_printf(seq, "offset rpcs %% cum %% |");
697 seq_printf(seq, " rpcs %% cum %%\n");
699 read_tot = lprocfs_oh_sum(&cli->cl_read_offset_hist);
700 write_tot = lprocfs_oh_sum(&cli->cl_write_offset_hist);
704 for (i = 0; i < OBD_HIST_MAX; i++) {
705 unsigned long r = cli->cl_read_offset_hist.oh_buckets[i];
706 unsigned long w = cli->cl_write_offset_hist.oh_buckets[i];
709 seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
710 (i == 0) ? 0 : 1 << (i - 1),
711 r, pct(r, read_tot), pct(read_cum, read_tot),
712 w, pct(w, write_tot), pct(write_cum, write_tot));
713 if (read_cum == read_tot && write_cum == write_tot)
717 client_obd_list_unlock(&cli->cl_loi_list_lock);
723 static ssize_t osc_rpc_stats_seq_write(struct file *file, const char *buf,
724 size_t len, loff_t *off)
726 struct seq_file *seq = file->private_data;
727 struct obd_device *dev = seq->private;
728 struct client_obd *cli = &dev->u.cli;
730 lprocfs_oh_clear(&cli->cl_read_rpc_hist);
731 lprocfs_oh_clear(&cli->cl_write_rpc_hist);
732 lprocfs_oh_clear(&cli->cl_read_page_hist);
733 lprocfs_oh_clear(&cli->cl_write_page_hist);
734 lprocfs_oh_clear(&cli->cl_read_offset_hist);
735 lprocfs_oh_clear(&cli->cl_write_offset_hist);
739 LPROC_SEQ_FOPS(osc_rpc_stats);
741 static int osc_stats_seq_show(struct seq_file *seq, void *v)
744 struct obd_device *dev = seq->private;
745 struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
747 do_gettimeofday(&now);
749 seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
750 now.tv_sec, now.tv_usec);
751 seq_printf(seq, "lockless_write_bytes\t\t"LPU64"\n",
752 stats->os_lockless_writes);
753 seq_printf(seq, "lockless_read_bytes\t\t"LPU64"\n",
754 stats->os_lockless_reads);
755 seq_printf(seq, "lockless_truncate\t\t"LPU64"\n",
756 stats->os_lockless_truncates);
760 static ssize_t osc_stats_seq_write(struct file *file, const char *buf,
761 size_t len, loff_t *off)
763 struct seq_file *seq = file->private_data;
764 struct obd_device *dev = seq->private;
765 struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
767 memset(stats, 0, sizeof(*stats));
771 LPROC_SEQ_FOPS(osc_stats);
773 int lproc_osc_attach_seqstat(struct obd_device *dev)
777 rc = lprocfs_seq_create(dev->obd_proc_entry, "osc_stats", 0644,
778 &osc_stats_fops, dev);
780 rc = lprocfs_obd_seq_create(dev, "rpc_stats", 0644,
781 &osc_rpc_stats_fops, dev);