diff mbox series

[2/3] fuse: remove usage of FR_WATING flag

Message ID 20230904143018.5709-3-shikemeng@huaweicloud.com (mailing list archive)
State New, archived
Headers show
Series Minor cleanups to fuse | expand

Commit Message

Kemeng Shi Sept. 4, 2023, 2:30 p.m. UTC
Each allocated request from fuse_request_alloc counts to num_waiting
before request is freed.
Simply drop num_waiting without FR_WAITING flag check in fuse_put_request
to remove unneeded usage of FR_WAITING flag.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 fs/fuse/dev.c    | 9 +--------
 fs/fuse/fuse_i.h | 2 --
 2 files changed, 1 insertion(+), 10 deletions(-)

Comments

Bernd Schubert Sept. 7, 2023, 10:53 p.m. UTC | #1
On 9/4/23 16:30, Kemeng Shi wrote:
> Each allocated request from fuse_request_alloc counts to num_waiting
> before request is freed.
> Simply drop num_waiting without FR_WAITING flag check in fuse_put_request
> to remove unneeded usage of FR_WAITING flag.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---
>   fs/fuse/dev.c    | 9 +--------
>   fs/fuse/fuse_i.h | 2 --
>   2 files changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> index 59e1357d4880..4f49b1946635 100644
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -139,7 +139,6 @@ static struct fuse_req *fuse_get_req(struct fuse_mount *fm, bool for_background)
>   	req->in.h.gid = from_kgid(fc->user_ns, current_fsgid());
>   	req->in.h.pid = pid_nr_ns(task_pid(current), fc->pid_ns);
>   
> -	__set_bit(FR_WAITING, &req->flags);
>   	if (for_background)
>   		__set_bit(FR_BACKGROUND, &req->flags);
>   
> @@ -171,11 +170,7 @@ static void fuse_put_request(struct fuse_req *req)
>   			spin_unlock(&fc->bg_lock);
>   		}
>   
> -		if (test_bit(FR_WAITING, &req->flags)) {
> -			__clear_bit(FR_WAITING, &req->flags);
> -			fuse_drop_waiting(fc);
> -		}
> -
> +		fuse_drop_waiting(fc);
>   		fuse_request_free(req);
>   	}
>   }
> @@ -495,7 +490,6 @@ ssize_t fuse_simple_request(struct fuse_mount *fm, struct fuse_args *args)
>   		if (!args->nocreds)
>   			fuse_force_creds(req);
>   
> -		__set_bit(FR_WAITING, &req->flags);
>   		__set_bit(FR_FORCE, &req->flags);
>   	} else {
>   		WARN_ON(args->nocreds);
> @@ -556,7 +550,6 @@ int fuse_simple_background(struct fuse_mount *fm, struct fuse_args *args,
>   		if (!req)
>   			return -ENOMEM;
>   		atomic_inc(&fc->num_waiting);
> -		__set_bit(FR_WAITING, &req->flags);
>   		__set_bit(FR_BACKGROUND, &req->flags);
>   	} else {
>   		WARN_ON(args->nocreds);
> diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> index 9b7fc7d3c7f1..45da5553bae3 100644
> --- a/fs/fuse/fuse_i.h
> +++ b/fs/fuse/fuse_i.h
> @@ -307,7 +307,6 @@ struct fuse_io_priv {
>    * FR_ISREPLY:		set if the request has reply
>    * FR_FORCE:		force sending of the request even if interrupted
>    * FR_BACKGROUND:	request is sent in the background
> - * FR_WAITING:		request is counted as "waiting"
>    * FR_ABORTED:		the request was aborted
>    * FR_INTERRUPTED:	the request has been interrupted
>    * FR_LOCKED:		data is being copied to/from the request
> @@ -321,7 +320,6 @@ enum fuse_req_flag {
>   	FR_ISREPLY,
>   	FR_FORCE,
>   	FR_BACKGROUND,
> -	FR_WAITING,
>   	FR_ABORTED,
>   	FR_INTERRUPTED,
>   	FR_LOCKED,

Yeah, at best it is a debug information, but as it is set anyway (also before
patch 1) before queuing it, there is not much to gain from it. Looks good to
me.
diff mbox series

Patch

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 59e1357d4880..4f49b1946635 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -139,7 +139,6 @@  static struct fuse_req *fuse_get_req(struct fuse_mount *fm, bool for_background)
 	req->in.h.gid = from_kgid(fc->user_ns, current_fsgid());
 	req->in.h.pid = pid_nr_ns(task_pid(current), fc->pid_ns);
 
-	__set_bit(FR_WAITING, &req->flags);
 	if (for_background)
 		__set_bit(FR_BACKGROUND, &req->flags);
 
@@ -171,11 +170,7 @@  static void fuse_put_request(struct fuse_req *req)
 			spin_unlock(&fc->bg_lock);
 		}
 
-		if (test_bit(FR_WAITING, &req->flags)) {
-			__clear_bit(FR_WAITING, &req->flags);
-			fuse_drop_waiting(fc);
-		}
-
+		fuse_drop_waiting(fc);
 		fuse_request_free(req);
 	}
 }
@@ -495,7 +490,6 @@  ssize_t fuse_simple_request(struct fuse_mount *fm, struct fuse_args *args)
 		if (!args->nocreds)
 			fuse_force_creds(req);
 
-		__set_bit(FR_WAITING, &req->flags);
 		__set_bit(FR_FORCE, &req->flags);
 	} else {
 		WARN_ON(args->nocreds);
@@ -556,7 +550,6 @@  int fuse_simple_background(struct fuse_mount *fm, struct fuse_args *args,
 		if (!req)
 			return -ENOMEM;
 		atomic_inc(&fc->num_waiting);
-		__set_bit(FR_WAITING, &req->flags);
 		__set_bit(FR_BACKGROUND, &req->flags);
 	} else {
 		WARN_ON(args->nocreds);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 9b7fc7d3c7f1..45da5553bae3 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -307,7 +307,6 @@  struct fuse_io_priv {
  * FR_ISREPLY:		set if the request has reply
  * FR_FORCE:		force sending of the request even if interrupted
  * FR_BACKGROUND:	request is sent in the background
- * FR_WAITING:		request is counted as "waiting"
  * FR_ABORTED:		the request was aborted
  * FR_INTERRUPTED:	the request has been interrupted
  * FR_LOCKED:		data is being copied to/from the request
@@ -321,7 +320,6 @@  enum fuse_req_flag {
 	FR_ISREPLY,
 	FR_FORCE,
 	FR_BACKGROUND,
-	FR_WAITING,
 	FR_ABORTED,
 	FR_INTERRUPTED,
 	FR_LOCKED,