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, 2012, 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/statfs.h>
39 #include "../include/obd_cksum.h"
40 #include "../include/obd_class.h"
41 #include "../include/lprocfs_status.h"
42 #include <linux/seq_file.h>
43 #include "osc_internal.h"
45 static int osc_active_seq_show(struct seq_file *m, void *v)
47 struct obd_device *dev = m->private;
49 LPROCFS_CLIMP_CHECK(dev);
50 seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
51 LPROCFS_CLIMP_EXIT(dev);
56 static ssize_t osc_active_seq_write(struct file *file,
57 const char __user *buffer,
58 size_t count, loff_t *off)
60 struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
63 rc = lprocfs_write_helper(buffer, count, &val);
66 if (val < 0 || val > 1)
70 if (dev->u.cli.cl_import->imp_deactive == val)
71 rc = ptlrpc_set_import_active(dev->u.cli.cl_import, val);
73 CDEBUG(D_CONFIG, "activate %d: ignoring repeat request\n", val);
77 LPROC_SEQ_FOPS(osc_active);
79 static int osc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
81 struct obd_device *dev = m->private;
82 struct client_obd *cli = &dev->u.cli;
84 client_obd_list_lock(&cli->cl_loi_list_lock);
85 seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight);
86 client_obd_list_unlock(&cli->cl_loi_list_lock);
91 static ssize_t osc_max_rpcs_in_flight_seq_write(struct file *file,
92 const char __user *buffer,
93 size_t count, loff_t *off)
95 struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
96 struct client_obd *cli = &dev->u.cli;
97 struct ptlrpc_request_pool *pool = cli->cl_import->imp_rq_pool;
100 rc = lprocfs_write_helper(buffer, count, &val);
104 if (val < 1 || val > OSC_MAX_RIF_MAX)
107 LPROCFS_CLIMP_CHECK(dev);
108 if (pool && val > cli->cl_max_rpcs_in_flight)
109 pool->prp_populate(pool, val-cli->cl_max_rpcs_in_flight);
111 client_obd_list_lock(&cli->cl_loi_list_lock);
112 cli->cl_max_rpcs_in_flight = val;
113 client_obd_list_unlock(&cli->cl_loi_list_lock);
115 LPROCFS_CLIMP_EXIT(dev);
118 LPROC_SEQ_FOPS(osc_max_rpcs_in_flight);
120 static int osc_max_dirty_mb_seq_show(struct seq_file *m, void *v)
122 struct obd_device *dev = m->private;
123 struct client_obd *cli = &dev->u.cli;
127 client_obd_list_lock(&cli->cl_loi_list_lock);
128 val = cli->cl_dirty_max;
129 client_obd_list_unlock(&cli->cl_loi_list_lock);
132 return lprocfs_seq_read_frac_helper(m, val, mult);
135 static ssize_t osc_max_dirty_mb_seq_write(struct file *file,
136 const char __user *buffer,
137 size_t count, loff_t *off)
139 struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
140 struct client_obd *cli = &dev->u.cli;
141 int pages_number, mult, rc;
143 mult = 1 << (20 - PAGE_CACHE_SHIFT);
144 rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
148 if (pages_number <= 0 ||
149 pages_number > OSC_MAX_DIRTY_MB_MAX << (20 - PAGE_CACHE_SHIFT) ||
150 pages_number > totalram_pages / 4) /* 1/4 of RAM */
153 client_obd_list_lock(&cli->cl_loi_list_lock);
154 cli->cl_dirty_max = (u32)(pages_number << PAGE_CACHE_SHIFT);
155 osc_wake_cache_waiters(cli);
156 client_obd_list_unlock(&cli->cl_loi_list_lock);
160 LPROC_SEQ_FOPS(osc_max_dirty_mb);
162 static int osc_cached_mb_seq_show(struct seq_file *m, void *v)
164 struct obd_device *dev = m->private;
165 struct client_obd *cli = &dev->u.cli;
166 int shift = 20 - PAGE_CACHE_SHIFT;
171 (atomic_read(&cli->cl_lru_in_list) +
172 atomic_read(&cli->cl_lru_busy)) >> shift,
173 atomic_read(&cli->cl_lru_busy));
178 /* shrink the number of caching pages to a specific number */
179 static ssize_t osc_cached_mb_seq_write(struct file *file,
180 const char __user *buffer,
181 size_t count, loff_t *off)
183 struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
184 struct client_obd *cli = &dev->u.cli;
185 int pages_number, mult, rc;
188 if (count >= sizeof(kernbuf))
191 if (copy_from_user(kernbuf, buffer, count))
195 mult = 1 << (20 - PAGE_CACHE_SHIFT);
196 buffer += lprocfs_find_named_value(kernbuf, "used_mb:", &count) -
198 rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
202 if (pages_number < 0)
205 rc = atomic_read(&cli->cl_lru_in_list) - pages_number;
207 (void)osc_lru_shrink(cli, rc);
211 LPROC_SEQ_FOPS(osc_cached_mb);
213 static int osc_cur_dirty_bytes_seq_show(struct seq_file *m, void *v)
215 struct obd_device *dev = m->private;
216 struct client_obd *cli = &dev->u.cli;
218 client_obd_list_lock(&cli->cl_loi_list_lock);
219 seq_printf(m, "%lu\n", cli->cl_dirty);
220 client_obd_list_unlock(&cli->cl_loi_list_lock);
224 LPROC_SEQ_FOPS_RO(osc_cur_dirty_bytes);
226 static int osc_cur_grant_bytes_seq_show(struct seq_file *m, void *v)
228 struct obd_device *dev = m->private;
229 struct client_obd *cli = &dev->u.cli;
231 client_obd_list_lock(&cli->cl_loi_list_lock);
232 seq_printf(m, "%lu\n", cli->cl_avail_grant);
233 client_obd_list_unlock(&cli->cl_loi_list_lock);
238 static ssize_t osc_cur_grant_bytes_seq_write(struct file *file,
239 const char __user *buffer,
240 size_t count, loff_t *off)
242 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
243 struct client_obd *cli = &obd->u.cli;
250 rc = lprocfs_write_u64_helper(buffer, count, &val);
254 /* this is only for shrinking grant */
255 client_obd_list_lock(&cli->cl_loi_list_lock);
256 if (val >= cli->cl_avail_grant) {
257 client_obd_list_unlock(&cli->cl_loi_list_lock);
260 client_obd_list_unlock(&cli->cl_loi_list_lock);
262 LPROCFS_CLIMP_CHECK(obd);
263 if (cli->cl_import->imp_state == LUSTRE_IMP_FULL)
264 rc = osc_shrink_grant_to_target(cli, val);
265 LPROCFS_CLIMP_EXIT(obd);
270 LPROC_SEQ_FOPS(osc_cur_grant_bytes);
272 static int osc_cur_lost_grant_bytes_seq_show(struct seq_file *m, void *v)
274 struct obd_device *dev = m->private;
275 struct client_obd *cli = &dev->u.cli;
277 client_obd_list_lock(&cli->cl_loi_list_lock);
278 seq_printf(m, "%lu\n", cli->cl_lost_grant);
279 client_obd_list_unlock(&cli->cl_loi_list_lock);
283 LPROC_SEQ_FOPS_RO(osc_cur_lost_grant_bytes);
285 static int osc_grant_shrink_interval_seq_show(struct seq_file *m, void *v)
287 struct obd_device *obd = m->private;
291 seq_printf(m, "%d\n", obd->u.cli.cl_grant_shrink_interval);
295 static ssize_t osc_grant_shrink_interval_seq_write(struct file *file,
296 const char __user *buffer,
297 size_t count, loff_t *off)
299 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
305 rc = lprocfs_write_helper(buffer, count, &val);
312 obd->u.cli.cl_grant_shrink_interval = val;
316 LPROC_SEQ_FOPS(osc_grant_shrink_interval);
318 static int osc_checksum_seq_show(struct seq_file *m, void *v)
320 struct obd_device *obd = m->private;
325 seq_printf(m, "%d\n", obd->u.cli.cl_checksum ? 1 : 0);
329 static ssize_t osc_checksum_seq_write(struct file *file,
330 const char __user *buffer,
331 size_t count, loff_t *off)
333 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
339 rc = lprocfs_write_helper(buffer, count, &val);
343 obd->u.cli.cl_checksum = (val ? 1 : 0);
347 LPROC_SEQ_FOPS(osc_checksum);
349 static int osc_checksum_type_seq_show(struct seq_file *m, void *v)
351 struct obd_device *obd = m->private;
358 for (i = 0; i < ARRAY_SIZE(cksum_name); i++) {
359 if (((1 << i) & obd->u.cli.cl_supp_cksum_types) == 0)
361 if (obd->u.cli.cl_cksum_type == (1 << i))
362 seq_printf(m, "[%s] ", cksum_name[i]);
364 seq_printf(m, "%s ", cksum_name[i]);
370 static ssize_t osc_checksum_type_seq_write(struct file *file,
371 const char __user *buffer,
372 size_t count, loff_t *off)
374 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
382 if (count > sizeof(kernbuf) - 1)
384 if (copy_from_user(kernbuf, buffer, count))
386 if (count > 0 && kernbuf[count - 1] == '\n')
387 kernbuf[count - 1] = '\0';
389 kernbuf[count] = '\0';
391 for (i = 0; i < ARRAY_SIZE(cksum_name); i++) {
392 if (((1 << i) & obd->u.cli.cl_supp_cksum_types) == 0)
394 if (!strcmp(kernbuf, cksum_name[i])) {
395 obd->u.cli.cl_cksum_type = 1 << i;
401 LPROC_SEQ_FOPS(osc_checksum_type);
403 static int osc_resend_count_seq_show(struct seq_file *m, void *v)
405 struct obd_device *obd = m->private;
407 seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends));
411 static ssize_t osc_resend_count_seq_write(struct file *file,
412 const char __user *buffer,
413 size_t count, loff_t *off)
415 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
418 rc = lprocfs_write_helper(buffer, count, &val);
425 atomic_set(&obd->u.cli.cl_resends, val);
429 LPROC_SEQ_FOPS(osc_resend_count);
431 static int osc_contention_seconds_seq_show(struct seq_file *m, void *v)
433 struct obd_device *obd = m->private;
434 struct osc_device *od = obd2osc_dev(obd);
436 seq_printf(m, "%u\n", od->od_contention_time);
440 static ssize_t osc_contention_seconds_seq_write(struct file *file,
441 const char __user *buffer,
442 size_t count, loff_t *off)
444 struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
445 struct osc_device *od = obd2osc_dev(obd);
447 return lprocfs_write_helper(buffer, count, &od->od_contention_time) ?:
450 LPROC_SEQ_FOPS(osc_contention_seconds);
452 static int osc_lockless_truncate_seq_show(struct seq_file *m, void *v)
454 struct obd_device *obd = m->private;
455 struct osc_device *od = obd2osc_dev(obd);
457 seq_printf(m, "%u\n", od->od_lockless_truncate);
461 static ssize_t osc_lockless_truncate_seq_write(struct file *file,
462 const char __user *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;
477 seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_destroy_in_flight));
480 LPROC_SEQ_FOPS_RO(osc_destroys_in_flight);
482 static int osc_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *v)
484 return lprocfs_obd_rd_max_pages_per_rpc(m, m->private);
487 static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file,
488 const char __user *buffer,
489 size_t count, loff_t *off)
491 struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
492 struct client_obd *cli = &dev->u.cli;
493 struct obd_connect_data *ocd = &cli->cl_import->imp_connect_data;
497 rc = lprocfs_write_u64_helper(buffer, count, &val);
501 /* if the max_pages is specified in bytes, convert to pages */
502 if (val >= ONE_MB_BRW_SIZE)
503 val >>= PAGE_CACHE_SHIFT;
505 LPROCFS_CLIMP_CHECK(dev);
507 chunk_mask = ~((1 << (cli->cl_chunkbits - PAGE_CACHE_SHIFT)) - 1);
508 /* max_pages_per_rpc must be chunk aligned */
509 val = (val + ~chunk_mask) & chunk_mask;
510 if (val == 0 || val > ocd->ocd_brw_size >> PAGE_CACHE_SHIFT) {
511 LPROCFS_CLIMP_EXIT(dev);
514 client_obd_list_lock(&cli->cl_loi_list_lock);
515 cli->cl_max_pages_per_rpc = val;
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 LPROC_SEQ_FOPS_RO_TYPE(osc, uuid);
524 LPROC_SEQ_FOPS_RO_TYPE(osc, connect_flags);
525 LPROC_SEQ_FOPS_RO_TYPE(osc, blksize);
526 LPROC_SEQ_FOPS_RO_TYPE(osc, kbytestotal);
527 LPROC_SEQ_FOPS_RO_TYPE(osc, kbytesfree);
528 LPROC_SEQ_FOPS_RO_TYPE(osc, kbytesavail);
529 LPROC_SEQ_FOPS_RO_TYPE(osc, filestotal);
530 LPROC_SEQ_FOPS_RO_TYPE(osc, filesfree);
531 LPROC_SEQ_FOPS_RO_TYPE(osc, server_uuid);
532 LPROC_SEQ_FOPS_RO_TYPE(osc, conn_uuid);
533 LPROC_SEQ_FOPS_RO_TYPE(osc, timeouts);
534 LPROC_SEQ_FOPS_RO_TYPE(osc, state);
536 LPROC_SEQ_FOPS_WR_ONLY(osc, ping);
538 LPROC_SEQ_FOPS_RW_TYPE(osc, import);
539 LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov);
541 static struct lprocfs_vars lprocfs_osc_obd_vars[] = {
542 { "uuid", &osc_uuid_fops, NULL, 0 },
543 { "ping", &osc_ping_fops, NULL, 0222 },
544 { "connect_flags", &osc_connect_flags_fops, NULL, 0 },
545 { "blocksize", &osc_blksize_fops, NULL, 0 },
546 { "kbytestotal", &osc_kbytestotal_fops, NULL, 0 },
547 { "kbytesfree", &osc_kbytesfree_fops, NULL, 0 },
548 { "kbytesavail", &osc_kbytesavail_fops, NULL, 0 },
549 { "filestotal", &osc_filestotal_fops, NULL, 0 },
550 { "filesfree", &osc_filesfree_fops, NULL, 0 },
551 /*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/
552 { "ost_server_uuid", &osc_server_uuid_fops, NULL, 0 },
553 { "ost_conn_uuid", &osc_conn_uuid_fops, NULL, 0 },
554 { "active", &osc_active_fops, NULL },
555 { "max_pages_per_rpc", &osc_obd_max_pages_per_rpc_fops, NULL },
556 { "max_rpcs_in_flight", &osc_max_rpcs_in_flight_fops, NULL },
557 { "destroys_in_flight", &osc_destroys_in_flight_fops, NULL, 0 },
558 { "max_dirty_mb", &osc_max_dirty_mb_fops, NULL },
559 { "osc_cached_mb", &osc_cached_mb_fops, NULL },
560 { "cur_dirty_bytes", &osc_cur_dirty_bytes_fops, NULL, 0 },
561 { "cur_grant_bytes", &osc_cur_grant_bytes_fops, NULL },
562 { "cur_lost_grant_bytes", &osc_cur_lost_grant_bytes_fops, NULL, 0},
563 { "grant_shrink_interval", &osc_grant_shrink_interval_fops, NULL },
564 { "checksums", &osc_checksum_fops, NULL },
565 { "checksum_type", &osc_checksum_type_fops, NULL },
566 { "resend_count", &osc_resend_count_fops, NULL},
567 { "timeouts", &osc_timeouts_fops, NULL, 0 },
568 { "contention_seconds", &osc_contention_seconds_fops, NULL },
569 { "lockless_truncate", &osc_lockless_truncate_fops, NULL },
570 { "import", &osc_import_fops, NULL },
571 { "state", &osc_state_fops, NULL, 0 },
572 { "pinger_recov", &osc_pinger_recov_fops, NULL },
576 LPROC_SEQ_FOPS_RO_TYPE(osc, numrefs);
577 static struct lprocfs_vars lprocfs_osc_module_vars[] = {
578 { "num_refs", &osc_numrefs_fops, NULL, 0 },
582 #define pct(a, b) (b ? a * 100 / b : 0)
584 static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
587 struct obd_device *dev = seq->private;
588 struct client_obd *cli = &dev->u.cli;
589 unsigned long read_tot = 0, write_tot = 0, read_cum, write_cum;
592 do_gettimeofday(&now);
594 client_obd_list_lock(&cli->cl_loi_list_lock);
596 seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
597 now.tv_sec, (unsigned long)now.tv_usec);
598 seq_printf(seq, "read RPCs in flight: %d\n",
599 cli->cl_r_in_flight);
600 seq_printf(seq, "write RPCs in flight: %d\n",
601 cli->cl_w_in_flight);
602 seq_printf(seq, "pending write pages: %d\n",
603 atomic_read(&cli->cl_pending_w_pages));
604 seq_printf(seq, "pending read pages: %d\n",
605 atomic_read(&cli->cl_pending_r_pages));
607 seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
608 seq_puts(seq, "pages per rpc rpcs % cum % |");
609 seq_puts(seq, " rpcs % cum %\n");
611 read_tot = lprocfs_oh_sum(&cli->cl_read_page_hist);
612 write_tot = lprocfs_oh_sum(&cli->cl_write_page_hist);
616 for (i = 0; i < OBD_HIST_MAX; i++) {
617 unsigned long r = cli->cl_read_page_hist.oh_buckets[i];
618 unsigned long w = cli->cl_write_page_hist.oh_buckets[i];
621 seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
622 1 << i, r, pct(r, read_tot),
623 pct(read_cum, read_tot), w,
625 pct(write_cum, write_tot));
626 if (read_cum == read_tot && write_cum == write_tot)
630 seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
631 seq_puts(seq, "rpcs in flight rpcs % cum % |");
632 seq_puts(seq, " rpcs % cum %\n");
634 read_tot = lprocfs_oh_sum(&cli->cl_read_rpc_hist);
635 write_tot = lprocfs_oh_sum(&cli->cl_write_rpc_hist);
639 for (i = 0; i < OBD_HIST_MAX; i++) {
640 unsigned long r = cli->cl_read_rpc_hist.oh_buckets[i];
641 unsigned long w = cli->cl_write_rpc_hist.oh_buckets[i];
644 seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
645 i, r, pct(r, read_tot),
646 pct(read_cum, read_tot), w,
648 pct(write_cum, write_tot));
649 if (read_cum == read_tot && write_cum == write_tot)
653 seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
654 seq_puts(seq, "offset rpcs % cum % |");
655 seq_puts(seq, " rpcs % cum %\n");
657 read_tot = lprocfs_oh_sum(&cli->cl_read_offset_hist);
658 write_tot = lprocfs_oh_sum(&cli->cl_write_offset_hist);
662 for (i = 0; i < OBD_HIST_MAX; i++) {
663 unsigned long r = cli->cl_read_offset_hist.oh_buckets[i];
664 unsigned long w = cli->cl_write_offset_hist.oh_buckets[i];
667 seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
668 (i == 0) ? 0 : 1 << (i - 1),
669 r, pct(r, read_tot), pct(read_cum, read_tot),
670 w, pct(w, write_tot), pct(write_cum, write_tot));
671 if (read_cum == read_tot && write_cum == write_tot)
675 client_obd_list_unlock(&cli->cl_loi_list_lock);
681 static ssize_t osc_rpc_stats_seq_write(struct file *file,
682 const char __user *buf,
683 size_t len, loff_t *off)
685 struct seq_file *seq = file->private_data;
686 struct obd_device *dev = seq->private;
687 struct client_obd *cli = &dev->u.cli;
689 lprocfs_oh_clear(&cli->cl_read_rpc_hist);
690 lprocfs_oh_clear(&cli->cl_write_rpc_hist);
691 lprocfs_oh_clear(&cli->cl_read_page_hist);
692 lprocfs_oh_clear(&cli->cl_write_page_hist);
693 lprocfs_oh_clear(&cli->cl_read_offset_hist);
694 lprocfs_oh_clear(&cli->cl_write_offset_hist);
699 LPROC_SEQ_FOPS(osc_rpc_stats);
701 static int osc_stats_seq_show(struct seq_file *seq, void *v)
704 struct obd_device *dev = seq->private;
705 struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
707 do_gettimeofday(&now);
709 seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
710 now.tv_sec, (unsigned long)now.tv_usec);
711 seq_printf(seq, "lockless_write_bytes\t\t%llu\n",
712 stats->os_lockless_writes);
713 seq_printf(seq, "lockless_read_bytes\t\t%llu\n",
714 stats->os_lockless_reads);
715 seq_printf(seq, "lockless_truncate\t\t%llu\n",
716 stats->os_lockless_truncates);
720 static ssize_t osc_stats_seq_write(struct file *file,
721 const char __user *buf,
722 size_t len, loff_t *off)
724 struct seq_file *seq = file->private_data;
725 struct obd_device *dev = seq->private;
726 struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
728 memset(stats, 0, sizeof(*stats));
732 LPROC_SEQ_FOPS(osc_stats);
734 int lproc_osc_attach_seqstat(struct obd_device *dev)
738 rc = lprocfs_seq_create(dev->obd_proc_entry, "osc_stats", 0644,
739 &osc_stats_fops, dev);
741 rc = lprocfs_obd_seq_create(dev, "rpc_stats", 0644,
742 &osc_rpc_stats_fops, dev);
747 void lprocfs_osc_init_vars(struct lprocfs_static_vars *lvars)
749 lvars->module_vars = lprocfs_osc_module_vars;
750 lvars->obd_vars = lprocfs_osc_obd_vars;