Re: [PATCH 3/3] fuse: move fuse_put_request a bit to remove forward declaration

From: Kemeng Shi
Date: Tue Sep 12 2023 - 03:03:28 EST




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@xxxxxxxxxxxxxxx>
>> ---
>>   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
>