Rename the qos_thresholdrr parameter back to its original name of
qos_threshold_rr so that there is no interop breakage. Update
test to handle mdt_qos_threshold_rr which lines up with the name
of qos_* sysfs files. Since we are using directly kstrtouint()
we have to eat the '%' that could be passed in.
Change-Id: I318a2ece6910e28a7a2331851d13b2269cf23e28
Fixes:
c1d0a355a6a6 ("LU-12624 lod: alloc dir stripes by QoS")
Test-Parameters: trivial testlist=sanityn
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/36686
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
*
* Set the relative priority of free OST space compared to OST load when OSTs
* are space imbalanced. See qos_priofree_show() for description of
*
* Set the relative priority of free OST space compared to OST load when OSTs
* are space imbalanced. See qos_priofree_show() for description of
- * this parameter. See qos_thresholdrr_store() and lq_threshold_rr to
+ * this parameter. See qos_threshold_rr_store() and lq_threshold_rr to
* determine what constitutes "space imbalanced" OSTs.
*/
static ssize_t __qos_prio_free_store(struct kobject *kobj,
* determine what constitutes "space imbalanced" OSTs.
*/
static ssize_t __qos_prio_free_store(struct kobject *kobj,
/**
* Show threshold for "same space on all OSTs" rule.
*/
/**
* Show threshold for "same space on all OSTs" rule.
*/
-static ssize_t __qos_thresholdrr_show(struct kobject *kobj,
- struct attribute *attr, char *buf,
- bool is_mdt)
+static ssize_t __qos_threshold_rr_show(struct kobject *kobj,
+ struct attribute *attr, char *buf,
+ bool is_mdt)
{
struct dt_device *dt = container_of(kobj, struct dt_device,
dd_kobj);
{
struct dt_device *dt = container_of(kobj, struct dt_device,
dd_kobj);
(ltd->ltd_qos.lq_threshold_rr * 100 + 255) >> 8);
}
(ltd->ltd_qos.lq_threshold_rr * 100 + 255) >> 8);
}
-static ssize_t mdt_qos_thresholdrr_show(struct kobject *kobj,
- struct attribute *attr, char *buf)
+static ssize_t mdt_qos_threshold_rr_show(struct kobject *kobj,
+ struct attribute *attr, char *buf)
- return __qos_thresholdrr_show(kobj, attr, buf, true);
+ return __qos_threshold_rr_show(kobj, attr, buf, true);
-static ssize_t qos_thresholdrr_show(struct kobject *kobj,
- struct attribute *attr, char *buf)
+static ssize_t qos_threshold_rr_show(struct kobject *kobj,
+ struct attribute *attr, char *buf)
- return __qos_thresholdrr_show(kobj, attr, buf, false);
+ return __qos_threshold_rr_show(kobj, attr, buf, false);
* space so that more full OSTs are chosen less often, otherwise use the
* round-robin allocator for efficiency and performance.
*/
* space so that more full OSTs are chosen less often, otherwise use the
* round-robin allocator for efficiency and performance.
*/
-static ssize_t __qos_thresholdrr_store(struct kobject *kobj,
- struct attribute *attr,
- const char *buffer, size_t count,
- bool is_mdt)
+static ssize_t __qos_threshold_rr_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count,
+ bool is_mdt)
{
struct dt_device *dt = container_of(kobj, struct dt_device,
dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
{
struct dt_device *dt = container_of(kobj, struct dt_device,
dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
unsigned int val;
int rc;
unsigned int val;
int rc;
- rc = kstrtouint(buffer, 0, &val);
+ /* "100%\n\0" should be largest string */
+ if (count >= sizeof(buf))
+ return -ERANGE;
+
+ strncpy(buf, buffer, sizeof(buf));
+ buf[sizeof(buf) - 1] = '\0';
+ tmp = strchr(buf, '%');
+ if (tmp)
+ *tmp = '\0';
+
+ rc = kstrtouint(buf, 0, &val);
-static ssize_t mdt_qos_thresholdrr_store(struct kobject *kobj,
- struct attribute *attr,
- const char *buffer, size_t count)
+static ssize_t mdt_qos_threshold_rr_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
- return __qos_thresholdrr_store(kobj, attr, buffer, count, true);
+ return __qos_threshold_rr_store(kobj, attr, buffer, count, true);
-static ssize_t qos_thresholdrr_store(struct kobject *kobj,
- struct attribute *attr,
- const char *buffer, size_t count)
+static ssize_t qos_threshold_rr_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
- return __qos_thresholdrr_store(kobj, attr, buffer, count, false);
+ return __qos_threshold_rr_store(kobj, attr, buffer, count, false);
-LUSTRE_RW_ATTR(mdt_qos_thresholdrr);
-LUSTRE_RW_ATTR(qos_thresholdrr);
+LUSTRE_RW_ATTR(mdt_qos_threshold_rr);
+LUSTRE_RW_ATTR(qos_threshold_rr);
/**
* Show expiration period used to refresh cached statfs data, which
/**
* Show expiration period used to refresh cached statfs data, which
&lustre_attr_numobd.attr,
&lustre_attr_qos_maxage.attr,
&lustre_attr_qos_prio_free.attr,
&lustre_attr_numobd.attr,
&lustre_attr_qos_maxage.attr,
&lustre_attr_qos_prio_free.attr,
- &lustre_attr_qos_thresholdrr.attr,
+ &lustre_attr_qos_threshold_rr.attr,
&lustre_attr_mdt_stripecount.attr,
&lustre_attr_mdt_stripetype.attr,
&lustre_attr_mdt_activeobd.attr,
&lustre_attr_mdt_numobd.attr,
&lustre_attr_mdt_qos_maxage.attr,
&lustre_attr_mdt_qos_prio_free.attr,
&lustre_attr_mdt_stripecount.attr,
&lustre_attr_mdt_stripetype.attr,
&lustre_attr_mdt_activeobd.attr,
&lustre_attr_mdt_numobd.attr,
&lustre_attr_mdt_qos_maxage.attr,
&lustre_attr_mdt_qos_prio_free.attr,
- &lustre_attr_mdt_qos_thresholdrr.attr,
+ &lustre_attr_mdt_qos_threshold_rr.attr,
lod.lustre-MDT0000-mdtlov.mdt_qos_prio_free | head -n1)
lod_qos_prio_free=${lod_qos_prio_free%%%}
lod_qos_threshold_rr=$(do_facet mds1 $LCTL get_param -n \
lod.lustre-MDT0000-mdtlov.mdt_qos_prio_free | head -n1)
lod_qos_prio_free=${lod_qos_prio_free%%%}
lod_qos_threshold_rr=$(do_facet mds1 $LCTL get_param -n \
- lod.lustre-MDT0000-mdtlov.mdt_qos_thresholdrr | head -n1)
+ lod.lustre-MDT0000-mdtlov.mdt_qos_threshold_rr | head -n1)
lod_qos_threshold_rr=${lod_qos_threshold_rr%%%}
lod_qos_maxage=$(do_facet mds1 $LCTL get_param -n \
lod.lustre-MDT0000-mdtlov.qos_maxage | awk '{ print $1 }')
stack_trap "do_nodes $mdts $LCTL set_param \
lod.*.mdt_qos_prio_free=$lod_qos_prio_free > /dev/null" EXIT
stack_trap "do_nodes $mdts $LCTL set_param \
lod_qos_threshold_rr=${lod_qos_threshold_rr%%%}
lod_qos_maxage=$(do_facet mds1 $LCTL get_param -n \
lod.lustre-MDT0000-mdtlov.qos_maxage | awk '{ print $1 }')
stack_trap "do_nodes $mdts $LCTL set_param \
lod.*.mdt_qos_prio_free=$lod_qos_prio_free > /dev/null" EXIT
stack_trap "do_nodes $mdts $LCTL set_param \
- lod.*.mdt_qos_thresholdrr=$lod_qos_threshold_rr > /dev/null" \
+ lod.*.mdt_qos_threshold_rr=$lod_qos_threshold_rr > /dev/null" \
EXIT
stack_trap "do_nodes $mdts $LCTL set_param \
lod.*.mdt_qos_maxage=$lod_qos_maxage > /dev/null" EXIT
EXIT
stack_trap "do_nodes $mdts $LCTL set_param \
lod.*.mdt_qos_maxage=$lod_qos_maxage > /dev/null" EXIT
echo "Mkdir (stripe_count $stripe_count) roundrobin:"
$LCTL set_param lmv.*.qos_threshold_rr=100 > /dev/null
echo "Mkdir (stripe_count $stripe_count) roundrobin:"
$LCTL set_param lmv.*.qos_threshold_rr=100 > /dev/null
- do_nodes $mdts $LCTL set_param lod.*.mdt_qos_thresholdrr=100 > /dev/null
+ do_nodes $mdts $LCTL set_param lod.*.mdt_qos_threshold_rr=100 > /dev/null
testdir=$DIR/$tdir-s$stripe_count/rr
testdir=$DIR/$tdir-s$stripe_count/rr
$LCTL set_param lmv.*.qos_threshold_rr=$lmv_qos_threshold_rr > /dev/null
do_nodes $mdts $LCTL set_param \
$LCTL set_param lmv.*.qos_threshold_rr=$lmv_qos_threshold_rr > /dev/null
do_nodes $mdts $LCTL set_param \
- lod.*.mdt_qos_thresholdrr=$lod_qos_threshold_rr > /dev/null
+ lod.*.mdt_qos_threshold_rr=$lod_qos_threshold_rr > /dev/null
echo
echo "Check for uneven MDTs: "
echo
echo "Check for uneven MDTs: "