+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 / CFS_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 * CFS_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 int lprocfs_rd_sec_level(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = data;
+
+ return snprintf(page, count, "%d\n", obd->u.filter.fo_sec_level);
+}
+
+static int lprocfs_wr_sec_level(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 > LUSTRE_SEC_ALL || val < LUSTRE_SEC_NONE)
+ return -EINVAL;
+
+ if (val == LUSTRE_SEC_SPECIFY) {
+ CWARN("security level %d will be supported in future.\n",
+ LUSTRE_SEC_SPECIFY);
+ return -EINVAL;
+ }
+
+ obd->u.filter.fo_sec_level = val;
+ return count;
+}
+
+static int lprocfs_filter_rd_cache(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+ LASSERT(obd != NULL);
+
+ return snprintf(page, count, "%u\n", obd->u.filter.fo_read_cache);
+}
+
+static int lprocfs_filter_wr_cache(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+ int val, rc;
+ LASSERT(obd != NULL);
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+
+ if (rc)
+ return rc;
+
+ cfs_spin_lock_bh(&obd->u.filter.fo_flags_lock);
+ obd->u.filter.fo_read_cache = !!val;
+ cfs_spin_unlock_bh(&obd->u.filter.fo_flags_lock);
+ return count;
+}
+
+static int lprocfs_filter_rd_wcache(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+ LASSERT(obd != NULL);
+
+ return snprintf(page, count, "%u\n", obd->u.filter.fo_writethrough_cache);
+}
+
+static int lprocfs_filter_wr_wcache(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+ int val, rc;
+ LASSERT(obd != NULL);
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+
+ if (rc)
+ return rc;
+
+ cfs_spin_lock(&obd->u.filter.fo_flags_lock);
+ obd->u.filter.fo_writethrough_cache = !!val;
+ cfs_spin_unlock(&obd->u.filter.fo_flags_lock);
+ return count;
+}
+
+static int lprocfs_filter_rd_mds_sync(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+ LASSERT(obd != NULL);
+
+ return snprintf(page, count, "%u\n", obd->u.filter.fo_mds_ost_sync);
+}
+
+int lprocfs_filter_rd_degraded(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = data;
+
+ return snprintf(page, count, "%u\n", obd->u.filter.fo_raid_degraded);
+}
+
+int lprocfs_filter_wr_degraded(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;
+
+ cfs_spin_lock(&obd->u.filter.fo_flags_lock);
+ obd->u.filter.fo_raid_degraded = !!val;
+ cfs_spin_unlock(&obd->u.filter.fo_flags_lock);
+ return count;
+}
+
+int lprocfs_filter_rd_syncjournal(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_syncjournal);
+ return rc;
+}
+
+int lprocfs_filter_wr_syncjournal(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 < 0)
+ return -EINVAL;
+
+ obd->u.filter.fo_syncjournal = !!val;
+ filter_slc_set(&obd->u.filter);
+
+ return count;
+}
+
+static char *sync_on_cancel_states[] = {"never",
+ "blocking",
+ "always" };
+
+int lprocfs_filter_rd_sync_lock_cancel(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = data;
+ int rc;
+
+ rc = snprintf(page, count, "%s\n",
+ sync_on_cancel_states[obd->u.filter.fo_sync_lock_cancel]);
+ return rc;
+}
+
+int lprocfs_filter_wr_sync_lock_cancel(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ int val = -1;
+ int i;
+
+ for (i = 0 ; i < NUM_SYNC_ON_CANCEL_STATES; i++) {
+ if (memcmp(buffer, sync_on_cancel_states[i],
+ strlen(sync_on_cancel_states[i])) == 0) {
+ val = i;
+ break;
+ }
+ }
+ if (val == -1) {
+ int rc;
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+ }
+
+ if (val < 0 || val > 2)
+ return -EINVAL;
+
+ obd->u.filter.fo_sync_lock_cancel = val;
+ return count;
+}
+
+static struct lprocfs_vars lprocfs_filter_obd_vars[] = {