Whamcloud - gitweb
land b1_5 onto HEAD
[fs/lustre-release.git] / lustre / obdfilter / lproc_obdfilter.c
index 5cd3e6b..a56bcff 100644 (file)
@@ -3,44 +3,41 @@
  *
  *  Copyright (C) 2002, 2003 Cluster File Systems, Inc.
  *
- *   This file is part of Lustre, http://www.lustre.org.
+ *   This file is part of the Lustre file system, http://www.lustre.org
+ *   Lustre is a trademark of Cluster File Systems, Inc.
  *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
+ *   You may have signed or agreed to another license before downloading
+ *   this software.  If so, you are bound by the terms and conditions
+ *   of that agreement, and the following does not apply to you.  See the
+ *   LICENSE file included with this distribution for more information.
  *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+ *   If you did not agree to a different license, then this copy of Lustre
+ *   is open source software; you can redistribute it and/or modify it
+ *   under the terms of version 2 of the GNU General Public License as
+ *   published by the Free Software Foundation.
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *   In either case, Lustre is distributed in the hope that it will be
+ *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   license text for more details.
  *
  */
 #define DEBUG_SUBSYSTEM S_CLASS
 
 #include <linux/version.h>
-#include <linux/lprocfs_status.h>
-#include <linux/obd.h>
+#include <lprocfs_status.h>
+#include <obd.h>
 #include <linux/seq_file.h>
 #include <linux/version.h>
 
 #include "filter_internal.h"
 
-#ifndef LPROCFS
-static struct lprocfs_vars lprocfs_obd_vars[]  = { {0} };
-static struct lprocfs_vars lprocfs_module_vars[] = { {0} };
-#else
-
+#ifdef LPROCFS
 static int lprocfs_filter_rd_groups(char *page, char **start, off_t off,
                                     int count, int *eof, void *data)
 {
-        struct obd_device *obd = (struct obd_device *)data;
-        
         *eof = 1;
-        return snprintf(page, count, "%u\n", obd->u.filter.fo_group_count);
+        return snprintf(page, count, "%u\n", FILTER_GROUPS);
 }
 
 static int lprocfs_filter_rd_tot_dirty(char *page, char **start, off_t off,
@@ -89,23 +86,12 @@ static int lprocfs_filter_rd_last_id(char *page, char **start, off_t off,
                                      int count, int *eof, void *data)
 {
         struct obd_device *obd = data;
-        struct filter_obd *filter = &obd->u.filter;
-        int retval = 0, rc, i;
 
         if (obd == NULL)
                 return 0;
 
-        for (i = 1; i < filter->fo_group_count; i++) {
-                rc = snprintf(page, count, LPU64"\n",filter_last_id(filter, i));
-                if (rc < 0) {
-                        retval = rc;
-                        break;
-                }
-                page += rc;
-                count -= rc;
-                retval += rc;
-        }
-        return retval;
+        return snprintf(page, count, LPU64"\n",
+                        filter_last_id(&obd->u.filter, 0));
 }
 
 int lprocfs_filter_rd_readcache(char *page, char **start, off_t off, int count,
@@ -134,19 +120,18 @@ int lprocfs_filter_wr_readcache(struct file *file, const char *buffer,
         return count;
 }
 
-int lprocfs_filter_rd_capa_stat(char *page, char **start, off_t off, int count,
-                                int *eof, void *data)
+int lprocfs_filter_rd_fmd_max_num(char *page, char **start, off_t off,
+                                  int count, int *eof, void *data)
 {
         struct obd_device *obd = data;
         int rc;
 
-        rc = snprintf(page, count, "%d\n",
-                      obd->u.filter.fo_capa_stat);
+        rc = snprintf(page, count, "%u\n", obd->u.filter.fo_fmd_max_num);
         return rc;
 }
 
-int lprocfs_filter_wr_capa_stat(struct file *file, const char *buffer,
-                                unsigned long count, void *data)
+int lprocfs_filter_wr_fmd_max_num(struct file *file, const char *buffer,
+                                  unsigned long count, void *data)
 {
         struct obd_device *obd = data;
         int val;
@@ -156,42 +141,38 @@ int lprocfs_filter_wr_capa_stat(struct file *file, const char *buffer,
         if (rc)
                 return rc;
 
-        obd->u.filter.fo_capa_stat = val;
+        if (val > 65536 || val < 1)
+                return -EINVAL;
+
+        obd->u.filter.fo_fmd_max_num = val;
         return count;
 }
 
-static
-int lprocfs_filter_rd_blacklist(char *page, char **start, off_t off, int count,
-                                int *eof, void *data)
+int lprocfs_filter_rd_fmd_max_age(char *page, char **start, off_t off,
+                                  int count, int *eof, void *data)
 {
+        struct obd_device *obd = data;
         int rc;
 
-        rc = blacklist_display(page, count);
-        *eof = 1;
+        rc = snprintf(page, count, "%u\n", obd->u.filter.fo_fmd_max_age / HZ);
         return rc;
 }
 
-static
-int lprocfs_filter_wr_blacklist(struct file *file, const char *buffer,
-                                unsigned long count, void *data)
+int lprocfs_filter_wr_fmd_max_age(struct file *file, const char *buffer,
+                                  unsigned long count, void *data)
 {
-        int add;
-        uid_t uid = -1;
-
-        if (count < 2)
-                return count;
-        if (buffer[0] == '+')
-                add = 1;
-        else if (buffer[0] == '-')
-                add = 0;
-        else
-                return count;
-
-        sscanf(buffer + 1, "%u", &uid);
-        if (add)
-                blacklist_add(uid);
-        else
-                blacklist_del(uid);
+        struct obd_device *obd = data;
+        int val;
+        int rc;
+
+        rc = lprocfs_write_helper(buffer, count, &val);
+        if (rc)
+                return rc;
+
+        if (val > 65536 || val < 1)
+                return -EINVAL;
+
+        obd->u.filter.fo_fmd_max_age = val * HZ;
         return count;
 }
 
@@ -210,15 +191,23 @@ static struct lprocfs_vars lprocfs_obd_vars[] = {
         { "tot_dirty",    lprocfs_filter_rd_tot_dirty,   0, 0 },
         { "tot_pending",  lprocfs_filter_rd_tot_pending, 0, 0 },
         { "tot_granted",  lprocfs_filter_rd_tot_granted, 0, 0 },
+        { "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 },
+        { "evict_client", 0, lprocfs_wr_evict_client, 0 },
         { "num_exports",  lprocfs_rd_num_exports,   0, 0 },
         { "readcache_max_filesize",
                           lprocfs_filter_rd_readcache,
                           lprocfs_filter_wr_readcache, 0 },
-        { "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 },
-        { "capa",         lprocfs_filter_rd_capa_stat,
-                          lprocfs_filter_wr_capa_stat, 0 },
-        { "blacklist",    lprocfs_filter_rd_blacklist,
-                          lprocfs_filter_wr_blacklist, 0 },
+#ifdef HAVE_QUOTA_SUPPORT
+        { "quota_bunit_sz", lprocfs_rd_bunit, lprocfs_wr_bunit, 0},
+        { "quota_btune_sz", lprocfs_rd_btune, lprocfs_wr_btune, 0},
+        { "quota_iunit_sz", lprocfs_rd_iunit, lprocfs_wr_iunit, 0},
+        { "quota_itune_sz", lprocfs_rd_itune, lprocfs_wr_itune, 0},
+        { "quota_type",     lprocfs_rd_type, lprocfs_wr_type, 0},
+#endif
+        { "client_cache_count", lprocfs_filter_rd_fmd_max_num,
+                          lprocfs_filter_wr_fmd_max_num, 0 },
+        { "client_cache_seconds", lprocfs_filter_rd_fmd_max_age,
+                          lprocfs_filter_wr_fmd_max_age, 0 },
         { 0 }
 };
 
@@ -227,9 +216,11 @@ static struct lprocfs_vars lprocfs_module_vars[] = {
         { 0 }
 };
 
-void filter_tally_write(struct filter_obd *filter, struct page **pages,
-                     int nr_pages, unsigned long *blocks, int blocks_per_page)
+void filter_tally_write(struct obd_export *exp, struct page **pages,
+                        int nr_pages, unsigned long *blocks,int blocks_per_page)
 {
+        struct filter_obd *filter = &exp->exp_obd->u.filter;
+        struct filter_export_data *fed = &exp->exp_filter_data;
         struct page *last_page = NULL;
         unsigned long *last_block = NULL;
         unsigned long discont_pages = 0;
@@ -239,7 +230,10 @@ void filter_tally_write(struct filter_obd *filter, struct page **pages,
         if (nr_pages == 0)
                 return;
 
-        lprocfs_oh_tally_log2(&filter->fo_w_pages, nr_pages);
+        lprocfs_oh_tally_log2(&filter->fo_filter_stats.hist[BRW_W_PAGES],
+                              nr_pages);
+        lprocfs_oh_tally_log2(&fed->fed_brw_stats.hist[BRW_W_PAGES],
+                              nr_pages);
 
         while (nr_pages-- > 0) {
                 if (last_page && (*pages)->index != (last_page->index + 1))
@@ -253,76 +247,75 @@ void filter_tally_write(struct filter_obd *filter, struct page **pages,
                 }
         }
 
-        lprocfs_oh_tally(&filter->fo_w_discont_pages, discont_pages);
-        lprocfs_oh_tally(&filter->fo_w_discont_blocks, discont_blocks);
+        lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_W_DISCONT_PAGES],
+                         discont_pages);
+        lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_W_DISCONT_BLOCKS],
+                         discont_blocks);
+
+        lprocfs_oh_tally(&fed->fed_brw_stats.hist[BRW_W_DISCONT_PAGES],
+                         discont_pages);
+        lprocfs_oh_tally(&fed->fed_brw_stats.hist[BRW_W_DISCONT_BLOCKS],
+                         discont_blocks);
 }
 
-void filter_tally_read(struct filter_obd *filter, struct niobuf_local *lnb,
-                       int niocount)
+void filter_tally_read(struct obd_export *exp, struct page **pages,
+                       int nr_pages, unsigned long *blocks, int blocks_per_page)
 {
-        struct niobuf_local *end;
+        struct filter_obd *filter = &exp->exp_obd->u.filter;
         struct page *last_page = NULL;
+        unsigned long *last_block = NULL;
         unsigned long discont_pages = 0;
         unsigned long discont_blocks = 0;
+        int i;
 
-        if (niocount == 0)
+        if (nr_pages == 0)
                 return;
 
-        for (end = lnb + niocount; lnb < end && lnb->page; lnb++) {
-                struct page *page = lnb->page;
-                if (last_page) {
-                       if (page->index != (last_page->index + 1))
-                                discont_pages++;
-                        /* XXX not so smart for now */
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-                        if ((page->buffers && last_page->buffers) &&
-                            (page->buffers->b_blocknr !=
-                             (last_page->buffers->b_blocknr + 1)))
+        lprocfs_oh_tally_log2(&filter->fo_filter_stats.hist[BRW_R_PAGES], nr_pages);
+
+        while (nr_pages-- > 0) {
+                if (last_page && (*pages)->index != (last_page->index + 1))
+                        discont_pages++;
+                last_page = *pages;
+                pages++;
+                for (i = 0; i < blocks_per_page; i++) {
+                        if (last_block && *blocks != (*last_block + 1))
                                 discont_blocks++;
-#else
-#warning "port on 2.6 -bzzz"
-#endif
+                        last_block = blocks++;
                 }
-                last_page = page;
         }
 
-        lprocfs_oh_tally_log2(&filter->fo_r_pages, niocount);
-        lprocfs_oh_tally(&filter->fo_r_discont_pages, discont_pages);
-        lprocfs_oh_tally(&filter->fo_r_discont_blocks, discont_blocks);
+        lprocfs_oh_tally_log2(&filter->fo_filter_stats.hist[BRW_R_PAGES], nr_pages);
+        lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_R_DISCONT_PAGES], discont_pages);
+        lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_R_DISCONT_BLOCKS], discont_blocks);
+
+        lprocfs_oh_tally_log2(&exp->exp_filter_data.fed_brw_stats.hist[BRW_R_PAGES],
+                              nr_pages);
+        lprocfs_oh_tally(&exp->exp_filter_data.fed_brw_stats.hist[BRW_R_DISCONT_PAGES],
+                         discont_pages);
+        lprocfs_oh_tally(&exp->exp_filter_data.fed_brw_stats.hist[BRW_R_DISCONT_BLOCKS],
+                         discont_blocks);
 }
 
 #define pct(a,b) (b ? a * 100 / b : 0)
 
-static int filter_brw_stats_seq_show(struct seq_file *seq, void *v)
+static void display_brw_stats(struct seq_file *seq, struct obd_histogram *read,
+                              struct obd_histogram *write)
 {
-        struct timeval now;
-        struct obd_device *dev = seq->private;
-        struct filter_obd *filter = &dev->u.filter;
         unsigned long read_tot = 0, write_tot = 0, read_cum, write_cum;
         int i;
 
-        do_gettimeofday(&now);
-
-        /* this sampling races with updates */
-
-        seq_printf(seq, "snapshot_time:         %lu.%lu (secs.usecs)\n",
-                   now.tv_sec, now.tv_usec);
-
-        seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
-        seq_printf(seq, "pages per brw         brws   %% cum %% |");
-        seq_printf(seq, "       rpcs   %% cum %%\n");
-
-        read_tot = lprocfs_oh_sum(&filter->fo_r_pages);
-        write_tot = lprocfs_oh_sum(&filter->fo_w_pages);
+        read_tot = lprocfs_oh_sum(read);
+        write_tot = lprocfs_oh_sum(write);
 
         read_cum = 0;
         write_cum = 0;
         for (i = 0; i < OBD_HIST_MAX; i++) {
-                unsigned long r = filter->fo_r_pages.oh_buckets[i];
-                unsigned long w = filter->fo_w_pages.oh_buckets[i];
+                unsigned long r = read->oh_buckets[i];
+                unsigned long w = write->oh_buckets[i];
                 read_cum += r;
                 write_cum += w;
-                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
+                seq_printf(seq, "%u:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
                                  1 << i, r, pct(r, read_tot),
                                  pct(read_cum, read_tot), w,
                                  pct(w, write_tot),
@@ -330,90 +323,106 @@ static int filter_brw_stats_seq_show(struct seq_file *seq, void *v)
                 if (read_cum == read_tot && write_cum == write_tot)
                         break;
         }
+}
+
+static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats)
+{
+        struct timeval now;
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+        unsigned long read_tot = 0, write_tot = 0, read_cum, write_cum;
+        int i;
+#endif
+
+        do_gettimeofday(&now);
+
+        /* this sampling races with updates */
+
+        seq_printf(seq, "snapshot_time:         %lu.%lu (secs.usecs)\n",
+                   now.tv_sec, now.tv_usec);
 
         seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
-        seq_printf(seq, "discont pages        rpcs   %% cum %% |");
+        seq_printf(seq, "pages per brw         brws   %% cum %% |");
         seq_printf(seq, "       rpcs   %% cum %%\n");
 
-        read_tot = lprocfs_oh_sum(&filter->fo_r_discont_pages);
-        write_tot = lprocfs_oh_sum(&filter->fo_w_discont_pages);
+        display_brw_stats(seq, &brw_stats->hist[BRW_R_PAGES], &brw_stats->hist[BRW_W_PAGES]);
 
-        read_cum = 0;
-        write_cum = 0;
+        seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+        seq_printf(seq, "discont pages         rpcs   %% cum %% |");
+        seq_printf(seq, "       rpcs   %% cum %%\n");
 
-        for (i = 0; i < OBD_HIST_MAX; i++) {
-                unsigned long r = filter->fo_r_discont_pages.oh_buckets[i];
-                unsigned long w = filter->fo_w_discont_pages.oh_buckets[i];
-                read_cum += r;
-                write_cum += w;
-                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
-                                 i, r, pct(r, read_tot),
-                                 pct(read_cum, read_tot), w,
-                                 pct(w, write_tot),
-                                 pct(write_cum, write_tot));
-                if (read_cum == read_tot && write_cum == write_tot)
-                        break;
-        }
+        display_brw_stats(seq, &brw_stats->hist[BRW_R_DISCONT_PAGES],
+                          &brw_stats->hist[BRW_W_DISCONT_PAGES]);
 
         seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
         seq_printf(seq, "discont blocks        rpcs   %% cum %% |");
         seq_printf(seq, "       rpcs   %% cum %%\n");
 
-        read_tot = lprocfs_oh_sum(&filter->fo_r_discont_blocks);
-        write_tot = lprocfs_oh_sum(&filter->fo_w_discont_blocks);
+        display_brw_stats(seq, &brw_stats->hist[BRW_R_DISCONT_BLOCKS],
+                          &brw_stats->hist[BRW_W_DISCONT_BLOCKS]);
+
+        seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+        seq_printf(seq, "dio frags             rpcs   %% cum %% |");
+        seq_printf(seq, "       rpcs   %% cum %%\n");
+
+        display_brw_stats(seq, &brw_stats->hist[BRW_R_DIO_FRAGS],
+                          &brw_stats->hist[BRW_W_DIO_FRAGS]);
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+        seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+        seq_printf(seq, "disk ios in flight     ios   %% cum %% |");
+        seq_printf(seq, "       rpcs   %% cum %%\n");
+
+        display_brw_stats(seq, &brw_stats->hist[BRW_R_RPC_HIST],
+                          &brw_stats->hist[BRW_W_RPC_HIST]);
+
+        seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+        seq_printf(seq, "io time (1/%ds)     rpcs   %% cum %% |", HZ);
+        seq_printf(seq, "       rpcs   %% cum %%\n");
+
+        display_brw_stats(seq, &brw_stats->hist[BRW_R_IO_TIME],
+                          &brw_stats->hist[BRW_W_IO_TIME]);
+
+        seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+        seq_printf(seq, "disk I/O size         count  %% cum %% |");
+        seq_printf(seq, "       count  %% cum %%\n");
+
+        read_tot = lprocfs_oh_sum(&brw_stats->hist[BRW_R_DISK_IOSIZE]);
+        write_tot = lprocfs_oh_sum(&brw_stats->hist[BRW_W_DISK_IOSIZE]);
 
         read_cum = 0;
         write_cum = 0;
         for (i = 0; i < OBD_HIST_MAX; i++) {
-                unsigned long r = filter->fo_r_discont_blocks.oh_buckets[i];
-                unsigned long w = filter->fo_w_discont_blocks.oh_buckets[i];
+                unsigned long r = brw_stats->hist[BRW_R_DISK_IOSIZE].oh_buckets[i];
+                unsigned long w = brw_stats->hist[BRW_W_DISK_IOSIZE].oh_buckets[i];
+
                 read_cum += r;
                 write_cum += w;
-                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
-                                 i, r, pct(r, read_tot),
-                                 pct(read_cum, read_tot), w,
-                                 pct(w, write_tot),
-                                 pct(write_cum, write_tot));
+                if (read_cum == 0 && write_cum == 0)
+                        continue;
+
+                if (i < 10)
+                        seq_printf(seq, "%u", 1<<i);
+                else if (i < 20)
+                        seq_printf(seq, "%uK", 1<<(i-10));
+                else
+                        seq_printf(seq, "%uM", 1<<(i-20));
+
+                seq_printf(seq, ":\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
+                           r, pct(r, read_tot), pct(read_cum, read_tot),
+                           w, pct(w, write_tot), pct(write_cum, write_tot));
                 if (read_cum == read_tot && write_cum == write_tot)
                         break;
         }
-
-        return 0;
+#endif
 }
-#undef pct
 
-static void *filter_brw_stats_seq_start(struct seq_file *p, loff_t *pos)
-{
-        if (*pos == 0)
-                return (void *)1;
-        return NULL;
-}
-static void *filter_brw_stats_seq_next(struct seq_file *p, void *v, loff_t *pos)
-{
-        ++*pos;
-        return NULL;
-}
-static void filter_brw_stats_seq_stop(struct seq_file *p, void *v)
+static int filter_brw_stats_seq_show(struct seq_file *seq, void *v)
 {
-}
-struct seq_operations filter_brw_stats_seq_sops = {
-        .start = filter_brw_stats_seq_start,
-        .stop = filter_brw_stats_seq_stop,
-        .next = filter_brw_stats_seq_next,
-        .show = filter_brw_stats_seq_show,
-};
+        struct obd_device *dev = seq->private;
+        struct filter_obd *filter = &dev->u.filter;
 
-static int filter_brw_stats_seq_open(struct inode *inode, struct file *file)
-{
-        struct proc_dir_entry *dp = PDE(inode);
-        struct seq_file *seq;
-        int rc;
+        brw_stats_show(seq, &filter->fo_filter_stats);
 
-        rc = seq_open(file, &filter_brw_stats_seq_sops);
-        if (rc)
-                return rc;
-        seq = file->private_data;
-        seq->private = dp->data;
         return 0;
 }
 
@@ -423,25 +432,15 @@ static ssize_t filter_brw_stats_seq_write(struct file *file, const char *buf,
         struct seq_file *seq = file->private_data;
         struct obd_device *dev = seq->private;
         struct filter_obd *filter = &dev->u.filter;
+        int i;
 
-        lprocfs_oh_clear(&filter->fo_r_pages);
-        lprocfs_oh_clear(&filter->fo_w_pages);
-        lprocfs_oh_clear(&filter->fo_r_discont_pages);
-        lprocfs_oh_clear(&filter->fo_w_discont_pages);
-        lprocfs_oh_clear(&filter->fo_r_discont_blocks);
-        lprocfs_oh_clear(&filter->fo_w_discont_blocks);
+        for (i = 0; i < BRW_LAST; i++)
+                lprocfs_oh_clear(&filter->fo_filter_stats.hist[i]);
 
         return len;
 }
 
-struct file_operations filter_brw_stats_fops = {
-        .owner   = THIS_MODULE,
-        .open    = filter_brw_stats_seq_open,
-        .read    = seq_read,
-        .write   = filter_brw_stats_seq_write,
-        .llseek  = seq_lseek,
-        .release = seq_release,
-};
+LPROC_SEQ_FOPS(filter_brw_stats);
 
 int lproc_filter_attach_seqstat(struct obd_device *dev)
 {
@@ -449,7 +448,29 @@ int lproc_filter_attach_seqstat(struct obd_device *dev)
                                       &filter_brw_stats_fops, dev);
 }
 
+static int filter_per_export_stats_seq_show(struct seq_file *seq, void *v)
+{
+        struct filter_export_data *fed = seq->private;
 
+        brw_stats_show(seq, &fed->fed_brw_stats);
+
+        return 0;
+}
+
+static ssize_t filter_per_export_stats_seq_write(struct file *file,
+                                       const char *buf, size_t len, loff_t *off)
+{
+        struct seq_file *seq = file->private_data;
+        struct filter_export_data *fed = seq->private;
+        int i;
+
+        for (i = 0; i < BRW_LAST; i++)
+                lprocfs_oh_clear(&fed->fed_brw_stats.hist[i]);
+
+        return len;
+}
+
+LPROC_SEQ_FOPS(filter_per_export_stats);
 
-#endif /* LPROCFS */
 LPROCFS_INIT_VARS(filter, lprocfs_module_vars, lprocfs_obd_vars)
+#endif /* LPROCFS */