Whamcloud - gitweb
LU-13365 ldlm: check slv and limit before updating 69/37969/3
authorWang Shilong <wshilong@ddn.com>
Wed, 18 Mar 2020 07:51:17 +0000 (15:51 +0800)
committerOleg Drokin <green@whamcloud.com>
Sun, 28 Jun 2020 02:47:06 +0000 (02:47 +0000)
slv and limit do not change for most of time,
ldlm_cli_update_pool() could be called for each RPC reply,
try hold read lock to check firstly could avoid heavy write
lock in hot path.

Change-Id: I4ef33132a463b3bac23863c09a2652f2d2782aae
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/37969
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/ldlm/ldlm_request.c

index 42225f9..4458ebc 100644 (file)
@@ -1449,6 +1449,14 @@ int ldlm_cli_update_pool(struct ptlrpc_request *req)
        new_slv = lustre_msg_get_slv(req->rq_repmsg);
        obd = req->rq_import->imp_obd;
 
+       read_lock(&obd->obd_pool_lock);
+       if (obd->obd_pool_slv == new_slv &&
+           obd->obd_pool_limit == new_limit) {
+               read_unlock(&obd->obd_pool_lock);
+               RETURN(0);
+       }
+       read_unlock(&obd->obd_pool_lock);
+
        /*
         * Set new SLV and limit in OBD fields to make them accessible
         * to the pool thread. We do not access obd_namespace and pool