dd_kobj);
struct osp_device *osp = dt2osp_dev(dt);
unsigned int val;
- int rc, i;
+ int rc;
if (!osp->opd_pre)
return -EINVAL;
-
rc = kstrtouint(buffer, 0, &val);
if (rc)
return rc;
* that is the maximum possible number of objects that will
* ever be handled by MDT->OST recovery processing.
*
+ * The OSP enforces the pre_create_count to amaximum of
+ * one half of opd_pre_max_create_count.
+ *
* If the OST ever gets a request to delete more orphans,
* this implies that something has gone badly on the MDT
* and the OST will refuse to delete so much data from the
- * filesystem as a safety measure. */
- if (val < OST_MIN_PRECREATE || val > OST_MAX_PRECREATE)
- return -ERANGE;
- if (val > osp->opd_pre_max_create_count)
+ * filesystem as a safety measure.
+ */
+ if (val < OST_MIN_PRECREATE)
return -ERANGE;
+ if (val > osp->opd_pre_max_create_count / 2)
+ val = osp->opd_pre_max_create_count / 2;
- for (i = 1; (i << 1) <= val; i <<= 1)
- ;
- osp->opd_pre_create_count = i;
+ /* set to largest value <= 32, 64, 128 or a multiple of 256 */
+ if (val > 256)
+ osp->opd_pre_create_count = val & 0xffffff00;
+ else
+ osp->opd_pre_create_count = rounddown_pow_of_two(val);
return count;
}
# create_count accepted values:
# [OST_MIN_PRECREATE=32, OST_MAX_PRECREATE=20000]
- # values outside this range are ignored and -ERANGE is returned.
- # NOTE: actual maximum value is 16384 (2^14)
+ # values exceeding OST_MAX_PRECREATE are lowered to the maximum.
[[ $create_count -lt 32 ]] && create_count=32
- [[ $create_count -gt 20000 ]] && create_count=20000
local i
for i in $(seq $MDSCOUNT); do
do_facet mds$i "$LCTL set_param -n \
lod.$FSNAME-MDT*.qos_threshold_rr=100 \
- osp.$FSNAME-OST*-osc-MDT*.create_count=$create_count" ||
- error "failed while setting qos_threshold_rr & creat_count"
+ osp.$FSNAME-OST*-osc-MDT*.create_count=$create_count"
done
# Create few temporary files in order to increase the precreated objects
}
run_test 822 "test precreate failure"
+test_823() {
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ local OST_MAX_PRECREATE=20000
+
+ save_lustre_params mds1 \
+ "osp.$FSNAME-OST*-osc-MDT0000.max_create_count" > $p
+ do_facet $SINGLEMDS "$LCTL set_param -n \
+ osp.$FSNAME-OST*MDT0000.max_create_count=0"
+ do_facet $SINGLEMDS "$LCTL set_param -n \
+ osp.$FSNAME-OST0000*MDT0000.max_create_count=$OST_MAX_PRECREATE"
+
+ stack_trap "restore_lustre_params < $p; rm $p"
+
+ do_facet $SINGLEMDS "$LCTL set_param -n \
+ osp.$FSNAME-OST*-osc-MDT*.create_count=100200"
+
+ local count=$(do_facet $SINGLEMDS "$LCTL get_param -n \
+ osp.$FSNAME-OST0000*MDT0000.create_count")
+ local max=$(do_facet $SINGLEMDS "$LCTL get_param -n \
+ osp.$FSNAME-OST0000*MDT0000.max_create_count")
+ local expect_count=$(((($max/2)/256) * 256))
+
+ log "setting create_count to 100200:"
+ log " -result- count: $count with max: $max, expecting: $expect_count"
+
+ [[ $count -eq expect_count ]] ||
+ error "Create count not set to max precreate."
+}
+run_test 823 "Setting create_count > OST_MAX_PRECREATE is lowered to maximum"
+
#
# tests that do cleanup/setup should be run at the end
#