+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 = FILTER_GROUP_MDS0; 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;
+}
+
+int lprocfs_filter_rd_readcache(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct obd_device *obd = data;
+ int rc;
+
+ rc = snprintf(page, count, LPU64"\n",
+ obd->u.filter.fo_readcache_max_filesize);
+ return rc;
+}
+
+int lprocfs_filter_wr_readcache(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ __u64 val;
+ int rc;
+
+ rc = lprocfs_write_u64_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ obd->u.filter.fo_readcache_max_filesize = val;
+ return count;
+}
+
+
+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, "%u\n", obd->u.filter.fo_fmd_max_num);
+ return rc;
+}
+
+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;
+ 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_num = val;
+ return count;
+}
+
+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 = snprintf(page, count, "%u\n", obd->u.filter.fo_fmd_max_age / HZ);
+ return rc;
+}
+
+int lprocfs_filter_wr_fmd_max_age(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ 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;
+}
+
+static int lprocfs_filter_rd_capa(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = data;
+ int rc;
+
+ rc = snprintf(page, count, "capability on: %s\n",
+ obd->u.filter.fo_fl_oss_capa ? "oss" : "");
+ return rc;
+}
+
+static int lprocfs_filter_wr_capa(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ if (val & ~0x1) {
+ CERROR("invalid capability mode, only 0/1 are accepted.\n"
+ " 1: enable oss fid capability\n"
+ " 0: disable oss fid capability\n");
+ return -EINVAL;
+ }
+
+ obd->u.filter.fo_fl_oss_capa = val;
+ LCONSOLE_INFO("OSS %s %s fid capability.\n", obd->obd_name,
+ val ? "enabled" : "disabled");
+ return count;
+}
+
+static int lprocfs_filter_rd_capa_count(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ return snprintf(page, count, "%d %d\n",
+ capa_count[CAPA_SITE_CLIENT],
+ capa_count[CAPA_SITE_SERVER]);
+}
+
+static struct lprocfs_vars lprocfs_filter_obd_vars[] = {
+ { "uuid", lprocfs_rd_uuid, 0, 0 },
+ { "blocksize", lprocfs_rd_blksize, 0, 0 },
+ { "kbytestotal", lprocfs_rd_kbytestotal, 0, 0 },
+ { "kbytesfree", lprocfs_rd_kbytesfree, 0, 0 },
+ { "kbytesavail", lprocfs_rd_kbytesavail, 0, 0 },
+ { "filestotal", lprocfs_rd_filestotal, 0, 0 },
+ { "filesfree", lprocfs_rd_filesfree, 0, 0 },
+ { "filegroups", lprocfs_filter_rd_groups, 0, 0 },
+ { "fstype", lprocfs_rd_fstype, 0, 0 },
+ { "mntdev", lprocfs_filter_rd_mntdev, 0, 0 },
+ { "last_id", lprocfs_filter_rd_last_id,0, 0 },
+ { "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 },
+ { "recovery_maxtime", lprocfs_obd_rd_recovery_maxtime,
+ lprocfs_obd_wr_recovery_maxtime, 0},
+ { "evict_client", 0, lprocfs_wr_evict_client, 0,
+ &lprocfs_evict_client_fops},
+ { "num_exports", lprocfs_rd_num_exports, 0, 0 },
+ { "readcache_max_filesize",
+ lprocfs_filter_rd_readcache,
+ lprocfs_filter_wr_readcache, 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 },
+ { "capa", lprocfs_filter_rd_capa,
+ lprocfs_filter_wr_capa, 0 },
+ { "capa_count", lprocfs_filter_rd_capa_count, 0, 0 },