Move fuse_put_request before fuse_get_req to remove forward declaration.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
fs/fuse/dev.c | 42 ++++++++++++++++++++----------------------
1 file changed, 20 insertions(+), 22 deletions(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 4f49b1946635..deda8b036de7 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -101,7 +101,26 @@ static void fuse_drop_waiting(struct fuse_conn *fc)
}
}
-static void fuse_put_request(struct fuse_req *req);
+static void fuse_put_request(struct fuse_req *req)
+{
+ struct fuse_conn *fc = req->fm->fc;
+
+ if (refcount_dec_and_test(&req->count)) {
+ if (test_bit(FR_BACKGROUND, &req->flags)) {
+ /*
+ * We get here in the unlikely case that a background
+ * request was allocated but not sent
+ */
+ spin_lock(&fc->bg_lock);
+ if (!fc->blocked)
+ wake_up(&fc->blocked_waitq);
+ spin_unlock(&fc->bg_lock);
+ }
+
+ fuse_drop_waiting(fc);
+ fuse_request_free(req);
+ }
+}
static struct fuse_req *fuse_get_req(struct fuse_mount *fm, bool for_background)
{
@@ -154,27 +173,6 @@ static struct fuse_req *fuse_get_req(struct fuse_mount *fm, bool for_background)
return ERR_PTR(err);
}
-static void fuse_put_request(struct fuse_req *req)
-{
- struct fuse_conn *fc = req->fm->fc;
-
- if (refcount_dec_and_test(&req->count)) {
- if (test_bit(FR_BACKGROUND, &req->flags)) {
- /*
- * We get here in the unlikely case that a background
- * request was allocated but not sent
- */
- spin_lock(&fc->bg_lock);
- if (!fc->blocked)
- wake_up(&fc->blocked_waitq);
- spin_unlock(&fc->bg_lock);
- }
-
- fuse_drop_waiting(fc);
- fuse_request_free(req);
- }
-}
-
unsigned int fuse_len_args(unsigned int numargs, struct fuse_arg *args)
{
unsigned nbytes = 0;
--
2.30.0
On 9/4/23 16:30, Kemeng Shi wrote:
> Move fuse_put_request before fuse_get_req to remove forward declaration.
>
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---
> fs/fuse/dev.c | 42 ++++++++++++++++++++----------------------
> 1 file changed, 20 insertions(+), 22 deletions(-)
>
> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> index 4f49b1946635..deda8b036de7 100644
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -101,7 +101,26 @@ static void fuse_drop_waiting(struct fuse_conn *fc)
> }
> }
>
> -static void fuse_put_request(struct fuse_req *req);
> +static void fuse_put_request(struct fuse_req *req)
> +{
> + struct fuse_conn *fc = req->fm->fc;
> +
> + if (refcount_dec_and_test(&req->count)) {
> + if (test_bit(FR_BACKGROUND, &req->flags)) {
> + /*
> + * We get here in the unlikely case that a background
> + * request was allocated but not sent
> + */
> + spin_lock(&fc->bg_lock);
> + if (!fc->blocked)
> + wake_up(&fc->blocked_waitq);
> + spin_unlock(&fc->bg_lock);
> + }
> +
> + fuse_drop_waiting(fc);
> + fuse_request_free(req);
> + }
> +}
>
> static struct fuse_req *fuse_get_req(struct fuse_mount *fm, bool for_background)
> {
> @@ -154,27 +173,6 @@ static struct fuse_req *fuse_get_req(struct fuse_mount *fm, bool for_background)
> return ERR_PTR(err);
> }
>
> -static void fuse_put_request(struct fuse_req *req)
> -{
> - struct fuse_conn *fc = req->fm->fc;
> -
> - if (refcount_dec_and_test(&req->count)) {
> - if (test_bit(FR_BACKGROUND, &req->flags)) {
> - /*
> - * We get here in the unlikely case that a background
> - * request was allocated but not sent
> - */
> - spin_lock(&fc->bg_lock);
> - if (!fc->blocked)
> - wake_up(&fc->blocked_waitq);
> - spin_unlock(&fc->bg_lock);
> - }
> -
> - fuse_drop_waiting(fc);
> - fuse_request_free(req);
> - }
> -}
> -
> unsigned int fuse_len_args(unsigned int numargs, struct fuse_arg *args)
> {
> unsigned nbytes = 0;
Hmm yeah, but it makes it harder to get history with git annotate/blame?
Thanks,
Bernd
on 9/8/2023 6:55 AM, Bernd Schubert wrote:
>
>
> On 9/4/23 16:30, Kemeng Shi wrote:
>> Move fuse_put_request before fuse_get_req to remove forward declaration.
>>
>> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
>> ---
>> fs/fuse/dev.c | 42 ++++++++++++++++++++----------------------
>> 1 file changed, 20 insertions(+), 22 deletions(-)
>>
>> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
>> index 4f49b1946635..deda8b036de7 100644
>> --- a/fs/fuse/dev.c
>> +++ b/fs/fuse/dev.c
>> @@ -101,7 +101,26 @@ static void fuse_drop_waiting(struct fuse_conn *fc)
>> }
>> }
>> -static void fuse_put_request(struct fuse_req *req);
>> +static void fuse_put_request(struct fuse_req *req)
>> +{
>> + struct fuse_conn *fc = req->fm->fc;
>> +
>> + if (refcount_dec_and_test(&req->count)) {
>> + if (test_bit(FR_BACKGROUND, &req->flags)) {
>> + /*
>> + * We get here in the unlikely case that a background
>> + * request was allocated but not sent
>> + */
>> + spin_lock(&fc->bg_lock);
>> + if (!fc->blocked)
>> + wake_up(&fc->blocked_waitq);
>> + spin_unlock(&fc->bg_lock);
>> + }
>> +
>> + fuse_drop_waiting(fc);
>> + fuse_request_free(req);
>> + }
>> +}
>> static struct fuse_req *fuse_get_req(struct fuse_mount *fm, bool for_background)
>> {
>> @@ -154,27 +173,6 @@ static struct fuse_req *fuse_get_req(struct fuse_mount *fm, bool for_background)
>> return ERR_PTR(err);
>> }
>> -static void fuse_put_request(struct fuse_req *req)
>> -{
>> - struct fuse_conn *fc = req->fm->fc;
>> -
>> - if (refcount_dec_and_test(&req->count)) {
>> - if (test_bit(FR_BACKGROUND, &req->flags)) {
>> - /*
>> - * We get here in the unlikely case that a background
>> - * request was allocated but not sent
>> - */
>> - spin_lock(&fc->bg_lock);
>> - if (!fc->blocked)
>> - wake_up(&fc->blocked_waitq);
>> - spin_unlock(&fc->bg_lock);
>> - }
>> -
>> - fuse_drop_waiting(fc);
>> - fuse_request_free(req);
>> - }
>> -}
>> -
>> unsigned int fuse_len_args(unsigned int numargs, struct fuse_arg *args)
>> {
>> unsigned nbytes = 0;
>
> Hmm yeah, but it makes it harder to get history with git annotate/blame?
>
Thanks for the feedbak, I will drop this and fix typo in patch 1 in next
version.
> Thanks,
> Bernd
>
© 2016 - 2026 Red Hat, Inc.