* Copyright 2008 Sun Microsystems, Inc. All rights reserved
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2016, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* \retval 0 on success
* \retval negative error code if failed
*/
+static int lod_dom_stripesize_seq_show(struct seq_file *m, void *v)
+{
+ struct obd_device *dev = m->private;
+ struct lod_device *lod;
+
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+ seq_printf(m, "%u\n", lod->lod_dom_max_stripesize);
+ return 0;
+}
+
+/**
+ * Set default stripe size.
+ *
+ * \param[in] file proc file
+ * \param[in] buffer string containing the maximum number of bytes stored in
+ * each object before moving to the next object in the
+ * layout (if any)
+ * \param[in] count @buffer length
+ * \param[in] off unused for single entry
+ *
+ * \retval @count on success
+ * \retval negative error code if failed
+ */
+static ssize_t
+lod_dom_stripesize_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 *dev = m->private;
+ struct lod_device *lod;
+ s64 val;
+ int rc;
+
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+ rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
+ if (rc)
+ return rc;
+ if (val < 0)
+ return -ERANGE;
+
+ /* 1GB is the limit */
+ if (val > (1ULL << 30))
+ return -ERANGE;
+ else if (val > 0)
+ lod_fix_desc_stripe_size(&val);
+
+ lod->lod_dom_max_stripesize = val;
+
+ return count;
+}
+LPROC_SEQ_FOPS(lod_dom_stripesize);
+
+/**
+ * Show default stripe size.
+ *
+ * \param[in] m seq file
+ * \param[in] v unused for single entry
+ *
+ * \retval 0 on success
+ * \retval negative error code if failed
+ */
static int lod_stripesize_seq_show(struct seq_file *m, void *v)
{
struct obd_device *dev = m->private;
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
struct lod_device *lod;
- __s64 val;
+ s64 val;
int rc;
LASSERT(dev != NULL);
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
struct lod_device *lod;
- __s64 val;
+ long val;
int rc;
LASSERT(dev != NULL);
lod = lu2lod_dev(dev->obd_lu_dev);
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtol_from_user(buffer, count, 0, &val);
if (rc)
return rc;
- if (val < -1)
+ if (val < -1 || val > LOV_MAX_STRIPE_COUNT)
return -ERANGE;
lod->lod_desc.ld_default_stripe_offset = val;
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
struct lod_device *lod;
+ u32 pattern;
int rc;
- __u32 pattern;
- __s64 val;
LASSERT(dev != NULL);
lod = lu2lod_dev(dev->obd_lu_dev);
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtouint_from_user(buffer, count, 0, &pattern);
if (rc)
return rc;
- if (val < 0)
- return -ERANGE;
- pattern = val;
lod_fix_desc_pattern(&pattern);
lod->lod_desc.ld_pattern = pattern;
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
struct lod_device *lod;
+ u32 stripe_count;
int rc;
- __s64 val;
- __u32 stripe_count;
LASSERT(dev != NULL);
- lod = lu2lod_dev(dev->obd_lu_dev);
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+ rc = kstrtouint_from_user(buffer, count, 0, &stripe_count);
if (rc)
return rc;
- if (val < -1)
- return -ERANGE;
- stripe_count = val;
lod_fix_desc_stripe_count(&stripe_count);
lod->lod_desc.ld_default_stripe_count = stripe_count;
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
struct lod_device *lod;
+ unsigned int val;
int rc;
- __s64 val;
LASSERT(dev != NULL);
lod = lu2lod_dev(dev->obd_lu_dev);
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtouint_from_user(buffer, count, 0, &val);
if (rc)
return rc;
- if (val < 0 || val > 100)
+ if (val > 100)
return -EINVAL;
lod->lod_qos.lq_prio_free = (val << 8) / 100;
lod->lod_qos.lq_dirty = 1;
char str[32];
unsigned int i;
int rc;
- __s64 val;
+ u32 val;
LASSERT(dev != NULL);
lod = lu2lod_dev(dev->obd_lu_dev);
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtouint_from_user(buffer, count, 0, &val);
if (rc)
return rc;
* propogate the value down to OSPs
*/
lustre_cfg_bufs_reset(&bufs, NULL);
- snprintf(str, 32, "%smaxage=%u", PARAM_OSP, (__u32)val);
+ snprintf(str, 32, "%smaxage=%u", PARAM_OSP, val);
lustre_cfg_bufs_set_string(&bufs, 1, str);
OBD_ALLOC(lcfg, lustre_cfg_len(bufs.lcfg_bufcount, bufs.lcfg_buflen));
if (lcfg == NULL)
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
struct lod_device *lod;
- __s64 val = 0;
+ bool val = 0;
int rc;
LASSERT(dev != NULL);
lod = lu2lod_dev(dev->obd_lu_dev);
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtobool_from_user(buffer, count, &val);
if (rc)
return rc;
- lod->lod_lmv_failout = !!val;
+ lod->lod_lmv_failout = val;
return count;
}
.fops = &lod_qos_maxage_fops },
{ .name = "lmv_failout",
.fops = &lod_lmv_failout_fops },
+ {
+ .name = "dom_stripesize",
+ .fops = &lod_dom_stripesize_fops
+ },
{ NULL }
};