-DEFINE_LPROCFS_STATFS_FCT(rd_blksize, obd_self_statfs);
-DEFINE_LPROCFS_STATFS_FCT(rd_kbytestotal, obd_self_statfs);
-DEFINE_LPROCFS_STATFS_FCT(rd_kbytesfree, obd_self_statfs);
-DEFINE_LPROCFS_STATFS_FCT(rd_filestotal, obd_self_statfs);
-DEFINE_LPROCFS_STATFS_FCT(rd_filesfree, obd_self_statfs);
-DEFINE_LPROCFS_STATFS_FCT(rd_filegroups, obd_self_statfs);
-
-struct lprocfs_vars lprocfs_obd_vars[] = {
- { "uuid", lprocfs_rd_uuid, 0, 0 },
- { "blocksize", rd_blksize, 0, 0 },
- { "kbytestotal", rd_kbytestotal, 0, 0 },
- { "kbytesfree", rd_kbytesfree, 0, 0 },
- { "filestotal", rd_filestotal, 0, 0 },
- { "filesfree", rd_filesfree, 0, 0 },
- { "filegroups", rd_filegroups, 0, 0 },
+int osc_rd_max_pages_per_rpc(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct obd_device *dev = data;
+ struct client_obd *cli = &dev->u.cli;
+ int rc;
+
+ spin_lock(&cli->cl_loi_list_lock);
+ rc = snprintf(page, count, "%d\n", cli->cl_max_pages_per_rpc);
+ spin_unlock(&cli->cl_loi_list_lock);
+ return rc;
+}
+
+int osc_wr_max_pages_per_rpc(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *dev = data;
+ struct client_obd *cli = &dev->u.cli;
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ if (val < 1 || val > PTLRPC_MAX_BRW_PAGES)
+ return -ERANGE;
+
+ spin_lock(&cli->cl_loi_list_lock);
+ cli->cl_max_pages_per_rpc = val;
+ spin_unlock(&cli->cl_loi_list_lock);
+
+ return count;
+}
+
+int osc_rd_max_rpcs_in_flight(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct obd_device *dev = data;
+ struct client_obd *cli = &dev->u.cli;
+ int rc;
+
+ spin_lock(&cli->cl_loi_list_lock);
+ rc = snprintf(page, count, "%u\n", cli->cl_max_rpcs_in_flight);
+ spin_unlock(&cli->cl_loi_list_lock);
+ return rc;
+}
+
+int osc_wr_max_rpcs_in_flight(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *dev = data;
+ struct client_obd *cli = &dev->u.cli;
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ if (val < 1 || val > OSC_MAX_RIF_MAX)
+ return -ERANGE;
+
+ spin_lock(&cli->cl_loi_list_lock);
+ cli->cl_max_rpcs_in_flight = val;
+ spin_unlock(&cli->cl_loi_list_lock);
+
+ return count;
+}
+
+int osc_rd_max_dirty_mb(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct obd_device *dev = data;
+ struct client_obd *cli = &dev->u.cli;
+ unsigned val;
+
+ spin_lock(&cli->cl_loi_list_lock);
+ val = cli->cl_dirty_max >> 20;
+ spin_unlock(&cli->cl_loi_list_lock);
+
+ return snprintf(page, count, "%u\n", val);
+}
+
+int osc_wr_max_dirty_mb(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *dev = data;
+ struct client_obd *cli = &dev->u.cli;
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ if (val < 0 || val > OSC_MAX_DIRTY_MB_MAX ||
+ val > num_physpages >> (20 - PAGE_SHIFT - 2)) /* 1/4 of RAM */
+ return -ERANGE;
+
+ spin_lock(&cli->cl_loi_list_lock);
+ cli->cl_dirty_max = (obd_count)val * 1024 * 1024;
+ osc_wake_cache_waiters(cli);
+ spin_unlock(&cli->cl_loi_list_lock);
+
+ return count;
+}
+
+int osc_rd_cur_dirty_bytes(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct obd_device *dev = data;
+ struct client_obd *cli = &dev->u.cli;
+ int rc;
+
+ spin_lock(&cli->cl_loi_list_lock);
+ rc = snprintf(page, count, "%lu\n", cli->cl_dirty);
+ spin_unlock(&cli->cl_loi_list_lock);
+ return rc;
+}
+
+int osc_rd_cur_grant_bytes(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct obd_device *dev = data;
+ struct client_obd *cli = &dev->u.cli;
+ int rc;
+
+ spin_lock(&cli->cl_loi_list_lock);
+ rc = snprintf(page, count, "%lu\n", cli->cl_avail_grant);
+ spin_unlock(&cli->cl_loi_list_lock);
+ return rc;
+}
+
+int osc_rd_create_low_wm(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct obd_device *obd = data;
+
+ if (obd == NULL)
+ return 0;
+
+ return snprintf(page, count, "%d\n",
+ obd->u.cli.cl_oscc.oscc_kick_barrier);
+}
+
+int osc_wr_create_low_wm(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ int val, rc;
+
+ if (obd == NULL)
+ return 0;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ if (val < 0)
+ return -ERANGE;
+
+ spin_lock(&obd->obd_dev_lock);
+ obd->u.cli.cl_oscc.oscc_kick_barrier = val;
+ spin_unlock(&obd->obd_dev_lock);
+
+ return count;
+}
+
+int osc_rd_create_count(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct obd_device *obd = data;
+
+ if (obd == NULL)
+ return 0;
+
+ return snprintf(page, count, "%d\n",
+ obd->u.cli.cl_oscc.oscc_grow_count);
+}
+
+int osc_wr_create_count(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ int val, rc;
+
+ if (obd == NULL)
+ return 0;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ if (val < 0)
+ return -ERANGE;
+
+ obd->u.cli.cl_oscc.oscc_grow_count = val;
+
+ return count;
+}
+
+int osc_rd_prealloc_next_id(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct obd_device *obd = data;
+
+ if (obd == NULL)
+ return 0;
+
+ return snprintf(page, count, LPU64"\n",
+ obd->u.cli.cl_oscc.oscc_next_id);
+}
+
+int osc_rd_prealloc_last_id(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct obd_device *obd = data;
+
+ if (obd == NULL)
+ return 0;
+
+ return snprintf(page, count, LPU64"\n",
+ obd->u.cli.cl_oscc.oscc_last_id);
+}
+
+static struct lprocfs_vars lprocfs_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_rd_filegroups, 0, 0 },