diff mbox series

ocfs2: refactor the noqueue_attempted

Message ID 20220319061028.3152-1-yili@winhong.com (mailing list archive)
State New
Headers show
Series ocfs2: refactor the noqueue_attempted | expand

Commit Message

Yi Li March 19, 2022, 6:10 a.m. UTC
The variable noqueue_attempted just set when DLM_LKF_NOQUEUE.
refactor the code.

Signed-off-by: Yi Li <yili@winhong.com>
---
 fs/ocfs2/dlmglue.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Joseph Qi March 20, 2022, 1:40 p.m. UTC | #1
Don't see any optimization after this change.

On 3/19/22 2:10 PM, Yi Li wrote:
> The variable noqueue_attempted just set when DLM_LKF_NOQUEUE.
> refactor the code.
> 
> Signed-off-by: Yi Li <yili@winhong.com>
> ---
>  fs/ocfs2/dlmglue.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
> index 801e60bab955..6315757c164d 100644
> --- a/fs/ocfs2/dlmglue.c
> +++ b/fs/ocfs2/dlmglue.c
> @@ -1547,12 +1547,11 @@ static int __ocfs2_cluster_lock(struct ocfs2_super *osb,
>  	}
>  
>  	if (level > lockres->l_level) {
> -		if (noqueue_attempted > 0) {
> +		if (noqueue_attempted) {
>  			ret = -EAGAIN;
>  			goto unlock;
>  		}
> -		if (lkm_flags & DLM_LKF_NOQUEUE)
> -			noqueue_attempted = 1;
> +		noqueue_attempted = lkm_flags & DLM_LKF_NOQUEUE;
>  
>  		if (lockres->l_action != OCFS2_AST_INVALID)
>  			mlog(ML_ERROR, "lockres %s has action %u pending\n",
diff mbox series

Patch

diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 801e60bab955..6315757c164d 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -1547,12 +1547,11 @@  static int __ocfs2_cluster_lock(struct ocfs2_super *osb,
 	}
 
 	if (level > lockres->l_level) {
-		if (noqueue_attempted > 0) {
+		if (noqueue_attempted) {
 			ret = -EAGAIN;
 			goto unlock;
 		}
-		if (lkm_flags & DLM_LKF_NOQUEUE)
-			noqueue_attempted = 1;
+		noqueue_attempted = lkm_flags & DLM_LKF_NOQUEUE;
 
 		if (lockres->l_action != OCFS2_AST_INVALID)
 			mlog(ML_ERROR, "lockres %s has action %u pending\n",