Whamcloud - gitweb
EX-5014 pcc: minor fixes for parameter checks
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 6 Sep 2022 18:47:56 +0000 (18:47 +0000)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 9 Sep 2022 01:31:53 +0000 (01:31 +0000)
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 <adilger@whamcloud.com>
Change-Id: I2bf7d0bf564c954318980f7a09d8713a70f37db9
Reviewed-on: https://review.whamcloud.com/48438
Reviewed-by: Qian Yingjin <qian@ddn.com>
lustre/llite/lproc_llite.c
lustre/tests/sanity-pcc.sh

index c1bdd63..c9b17b6 100644 (file)
@@ -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;
index 4b0c218..3bb0f60 100644 (file)
@@ -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"