Whamcloud - gitweb
LU-13030 pcc: Init saved dataset flags properly 23/36923/3
authorQian Yingjin <qian@ddn.com>
Wed, 4 Dec 2019 14:44:58 +0000 (22:44 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 5 Dec 2019 06:55:49 +0000 (06:55 +0000)
When init a new inode, the saved flags is set wrongly with
PCC_DATASET_NONE which means that the file is known in NONE
of PCC dataset.
This patch corrects it with PCC_DATASET_INVALID.

Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: Id775a20711cbc89979e81cbb2b0fe77dc5a850d5
Reviewed-on: https://review.whamcloud.com/36923
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/llite/llite_lib.c
lustre/llite/pcc.c
lustre/tests/sanity-pcc.sh

index cb92c40..933b77a 100644 (file)
@@ -1007,7 +1007,7 @@ void ll_lli_init(struct ll_inode_info *lli)
                mutex_init(&lli->lli_pcc_lock);
                lli->lli_pcc_state = PCC_STATE_FL_NONE;
                lli->lli_pcc_inode = NULL;
-               lli->lli_pcc_dsflags = PCC_DATASET_NONE;
+               lli->lli_pcc_dsflags = PCC_DATASET_INVALID;
                lli->lli_pcc_generation = 0;
                mutex_init(&lli->lli_group_mutex);
                lli->lli_group_users = 0;
index 57585e0..f5e4cae 100644 (file)
@@ -1338,21 +1338,18 @@ static int pcc_try_datasets_attach(struct inode *inode, enum pcc_io_type iot,
                 * from icache later.
                 * Set the saved dataset flags with PCC_DATASET_NONE. Then this
                 * file will skip from the candidates to try auto attach until
-                * the file is attached ninto PCC again.
+                * the file is attached into PCC again.
                 *
                 * If the file was never attached into PCC, or once attached but
                 * its inode was evicted from icache (lli_pcc_generation == 0),
+                * or the corresponding dataset was removed from the client,
                 * set the saved dataset flags with PCC_DATASET_NONE.
                 *
-                * If the file was once attached into PCC but the corresponding
-                * dataset was removed from the client, set the saved dataset
-                * flags with PCC_DATASET_NONE.
-                *
                 * TODO: If the file was once attached into PCC but not try to
                 * auto attach due to the change of the configuration parameters
                 * for this dataset (i.e. change from auto attach enabled to
                 * auto attach disabled for this dataset), update the saved
-                * dataset flags witha the found one.
+                * dataset flags with the found one.
                 */
                lli->lli_pcc_dsflags = PCC_DATASET_NONE;
        }
@@ -1431,7 +1428,7 @@ static inline bool pcc_may_auto_attach(struct inode *inode,
                return false;
 
        /*
-        * lli_pcc_generation = 0 means that the file was never attached into
+        * lli_pcc_generation == 0 means that the file was never attached into
         * PCC, or may be once attached into PCC but detached as the inode is
         * evicted from icache (i.e. "echo 3 > /proc/sys/vm/drop_caches" or
         * icache shrinking due to the memory pressure), which will cause the
@@ -1440,7 +1437,7 @@ static inline bool pcc_may_auto_attach(struct inode *inode,
         */
        /* lli_pcc_generation == 0, or the PCC setting was changed,
         * or there is no PCC setup on the client and the try will return
-        * immediately in pcc_try_auto_attch().
+        * immediately in pcc_try_auto_attach().
         */
        if (super->pccs_generation != lli->lli_pcc_generation)
                return true;
index 16515b6..09a40ff 100644 (file)
@@ -1463,6 +1463,9 @@ test_20() {
                error "Failed to attach $file"
        do_facet $SINGLEAGT "echo 3 > /proc/sys/vm/drop_caches"
        check_lpcc_state $file "readwrite"
+       do_facet $SINGLEAGT "echo 3 > /proc/sys/vm/drop_caches"
+       do_facet $SINGLEAGT "echo 3 > /proc/sys/vm/drop_caches"
+       check_lpcc_state $file "readwrite"
        do_facet $SINGLEAGT $LFS pcc detach $file ||
                error "Failed to detach $file"
 }