ofd_precreate_batch_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
+ struct seq_file *m = file->private_data;
struct obd_device *obd = m->private;
struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- int val;
+ __s64 val;
int rc;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
- if (val < 1)
+ if (val < 1 || val > INT_MAX)
return -EINVAL;
spin_lock(&ofd->ofd_batch_lock);
ofd_fmd_max_num_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *obd = m->private;
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- int val;
- int rc;
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ __s64 val;
+ int rc;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
struct seq_file *m = file->private_data;
struct obd_device *obd = m->private;
struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- int val;
+ __s64 val;
int rc;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
ofd_degraded_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *obd = m->private;
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- int val, rc;
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ int rc;
+ __s64 val;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
ofd_syncjournal_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *obd = m->private;
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- int val;
- int rc;
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ __s64 val;
+ int rc;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
/* This must be longer than the longest string below */
#define SYNC_STATES_MAXLEN 16
+
+static int ofd_brw_size_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+ seq_printf(m, "%u\n", ofd->ofd_brw_size / ONE_MB_BRW_SIZE);
+ return 0;
+}
+
+static ssize_t
+ofd_brw_size_seq_write(struct file *file, const char __user *buffer,
+ size_t count, loff_t *off)
+{
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ __s64 val;
+ int rc;
+
+ rc = lprocfs_str_to_s64(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ if (val < 0)
+ return -EINVAL;
+
+ val = val * ONE_MB_BRW_SIZE;
+ if (val <= 0 || val > DT_MAX_BRW_SIZE ||
+ val < (1 << ofd->ofd_blockbits))
+ return -ERANGE;
+
+ spin_lock(&ofd->ofd_flags_lock);
+ ofd->ofd_brw_size = val;
+ spin_unlock(&ofd->ofd_flags_lock);
+
+ return count;
+}
+LPROC_SEQ_FOPS(ofd_brw_size);
+
static char *sync_on_cancel_states[] = {"never",
"blocking",
"always" };
ofd_sync_lock_cancel_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *obd = m->private;
- struct lu_target *tgt = obd->u.obt.obt_lut;
- char kernbuf[SYNC_STATES_MAXLEN];
- int val = -1;
- int i;
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct lu_target *tgt = obd->u.obt.obt_lut;
+ char kernbuf[SYNC_STATES_MAXLEN];
+ __s64 val = -1;
+ int i;
if (count == 0 || count >= sizeof(kernbuf))
return -EINVAL;
/* Legacy numeric codes */
if (val == -1) {
- int rc;
-
- /* Safe to use userspace buffer as lprocfs_write_helper will
- * use copy from user for parsing */
- rc = lprocfs_write_helper(buffer, count, &val);
+ int rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
}
const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *obd = m->private;
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- int val;
- int rc;
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ __s64 val;
+ int rc;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
ofd_lfsck_speed_limit_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *obd = m->private;
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- __u32 val;
- int rc;
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ __s64 val;
+ int rc;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc != 0)
return rc;
+ if (val < 0)
+ return -ERANGE;
+
rc = lfsck_set_speed(ofd->ofd_osd, val);
return rc != 0 ? rc : count;
ofd_lfsck_verify_pfid_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *obd = m->private;
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- __u32 val;
- int rc;
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ __s64 val;
+ int rc;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc != 0)
return rc;
}
LPROC_SEQ_FOPS(ofd_lfsck_verify_pfid);
+static int ofd_site_stats_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = m->private;
+
+ return lu_site_stats_seq_print(obd->obd_lu_dev->ld_site, m);
+}
+LPROC_SEQ_FOPS_RO(ofd_site_stats);
+
LPROC_SEQ_FOPS_RO_TYPE(ofd, uuid);
LPROC_SEQ_FOPS_RO_TYPE(ofd, blksize);
LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytestotal);
.fops = &ofd_degraded_fops },
{ .name = "sync_journal",
.fops = &ofd_syncjournal_fops },
+ { .name = "brw_size",
+ .fops = &ofd_brw_size_fops },
{ .name = "sync_on_lock_cancel",
.fops = &ofd_sync_lock_cancel_fops },
{ .name = "instance",
.fops = &ofd_lfsck_layout_fops },
{ .name = "lfsck_verify_pfid",
.fops = &ofd_lfsck_verify_pfid_fops },
+ { .name = "site_stats",
+ .fops = &ofd_site_stats_fops },
{ NULL }
};