From: Andreas Dilger Date: Tue, 6 Sep 2022 18:47:56 +0000 (+0000) Subject: EX-5014 pcc: minor fixes for parameter checks X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=129537bcd73986993f7b279bfbe871dd3aac4c8f;p=fs%2Flustre-release.git EX-5014 pcc: minor fixes for parameter checks Improve console message when out-of-range pcc_dio_attach_size_mb values are supplied. Fix sanity-pcc test_49b to allow future limit changes. Test-Parameters: trivial testlist=sanity-pcc Signed-off-by: Andreas Dilger Change-Id: I2bf7d0bf564c954318980f7a09d8713a70f37db9 Reviewed-on: https://review.whamcloud.com/48438 Reviewed-by: Qian Yingjin --- diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index c1bdd63..c9b17b6 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -641,23 +641,19 @@ static ssize_t pcc_dio_attach_size_mb_store(struct kobject *kobj, u64 bytes; int rc; - /* this forces the size to be MiB aligned, which takes care of DIO - * alignment requirements - */ + /* forces bytes to be MiB aligned, which handles DIO alignment needs */ rc = sysfs_memparse(buffer, count, &bytes, "MiB"); if (rc) return rc; - if (bytes != 0 && (bytes < PCC_DIO_ATTACH_MINIOSIZE || - bytes > PCC_DIO_ATTACH_MAXIOSIZE)) { - CWARN("size (%llu) cannot be less than %d or greater than %d\n", - bytes / (1024 * 1024), - PCC_DIO_ATTACH_MINIOSIZE / (1024 * 1024), - PCC_DIO_ATTACH_MAXIOSIZE / (1024 * 1024)); - if (bytes > PCC_DIO_ATTACH_MAXIOSIZE) - bytes = PCC_DIO_ATTACH_MAXIOSIZE; - else if (bytes < PCC_DIO_ATTACH_MINIOSIZE) - bytes = PCC_DIO_ATTACH_MINIOSIZE; + if (bytes != 0 && bytes < PCC_DIO_ATTACH_MINIOSIZE) { + CWARN("PCC direct IO size %llu increased to minimum %d MiB\n", + bytes / 1048576, PCC_DIO_ATTACH_MINIOSIZE / 1048576); + bytes = PCC_DIO_ATTACH_MINIOSIZE; + } else if (bytes > PCC_DIO_ATTACH_MAXIOSIZE) { + CWARN("PCC direct IO size %llu limited to maximum %d MiB\n", + bytes / 1048576, PCC_DIO_ATTACH_MAXIOSIZE / 1048576); + bytes = PCC_DIO_ATTACH_MAXIOSIZE; } super->pccs_dio_attach_size_bytes = bytes; diff --git a/lustre/tests/sanity-pcc.sh b/lustre/tests/sanity-pcc.sh index 4b0c218..3bb0f60 100644 --- a/lustre/tests/sanity-pcc.sh +++ b/lustre/tests/sanity-pcc.sh @@ -3854,8 +3854,9 @@ test_49b() { do_facet $SINGLEAGT $LCTL set_param llite.*.pcc_dio_attach_size_mb=300 || error "setting iosize to > 256 MiB should be clamped" dio_attach_size=$(do_facet $SINGLEAGT $LCTL get_param -n llite.*.pcc_dio_attach_size_mb | head -n 1) - [[ $dio_attach_size == 256 ]] || - error "set iosize > 256 MiB should be clamped to 256 MiB" + # allow future limit increase, but at least check limit was changed + (( $dio_attach_size >= 256 )) || + error "set iosize > 256 MiB should not be clamped < 256 MiB" do_facet $SINGLEAGT $LCTL set_param llite.*.pcc_dio_attach_size_mb=0 || error "should be able to set attach size to 0"