kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] btrfs: send: use list_move_tail instead of list_del/list_add_tail
@ 2021-06-08  3:12 Baokun Li
  2021-06-08  5:16 ` Anand Jain
  0 siblings, 1 reply; 4+ messages in thread
From: Baokun Li @ 2021-06-08  3:12 UTC (permalink / raw)
  To: linux-kernel, Chris Mason, Josef Bacik, David Sterba
  Cc: weiyongjun1, yuehaibing, yangjihong1, yukuai3, libaokun1,
	linux-btrfs, kernel-janitors, Hulk Robot

Using list_move_tail() instead of list_del() + list_add_tail().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
 fs/btrfs/send.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index bd69db72acc5..a0e51b2416a1 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -2083,8 +2083,7 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx,
  */
 static void name_cache_used(struct send_ctx *sctx, struct name_cache_entry *nce)
 {
-	list_del(&nce->list);
-	list_add_tail(&nce->list, &sctx->name_cache_list);
+	list_move_tail(&nce->list, &sctx->name_cache_list);
 }
 
 /*


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] btrfs: send: use list_move_tail instead of list_del/list_add_tail
  2021-06-08  3:12 [PATCH -next] btrfs: send: use list_move_tail instead of list_del/list_add_tail Baokun Li
@ 2021-06-08  5:16 ` Anand Jain
  2021-06-08 14:12   ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Anand Jain @ 2021-06-08  5:16 UTC (permalink / raw)
  To: Baokun Li, linux-kernel, Chris Mason, Josef Bacik, David Sterba
  Cc: weiyongjun1, yuehaibing, yangjihong1, yukuai3, linux-btrfs,
	kernel-janitors, Hulk Robot

On 8/6/21 11:12 am, Baokun Li wrote:
> Using list_move_tail() instead of list_del() + list_add_tail().
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
> ---
>   fs/btrfs/send.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index bd69db72acc5..a0e51b2416a1 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -2083,8 +2083,7 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx,
>    */
>   static void name_cache_used(struct send_ctx *sctx, struct name_cache_entry *nce)
>   {
> -	list_del(&nce->list);
> -	list_add_tail(&nce->list, &sctx->name_cache_list);
> +	list_move_tail(&nce->list, &sctx->name_cache_list);
>   }


  Looks good.
  You can consider open-code name_cache_used() as there is only one user.

Thanks, Anand

>   /*
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] btrfs: send: use list_move_tail instead of list_del/list_add_tail
  2021-06-08  5:16 ` Anand Jain
@ 2021-06-08 14:12   ` David Sterba
  2021-06-11  6:05     ` libaokun (A)
  0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2021-06-08 14:12 UTC (permalink / raw)
  To: Anand Jain
  Cc: Baokun Li, linux-kernel, Chris Mason, Josef Bacik, David Sterba,
	weiyongjun1, yuehaibing, yangjihong1, yukuai3, linux-btrfs,
	kernel-janitors, Hulk Robot

On Tue, Jun 08, 2021 at 01:16:21PM +0800, Anand Jain wrote:
> On 8/6/21 11:12 am, Baokun Li wrote:
> > Using list_move_tail() instead of list_del() + list_add_tail().
> > 
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Baokun Li <libaokun1@huawei.com>
> > ---
> >   fs/btrfs/send.c | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> > index bd69db72acc5..a0e51b2416a1 100644
> > --- a/fs/btrfs/send.c
> > +++ b/fs/btrfs/send.c
> > @@ -2083,8 +2083,7 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx,
> >    */
> >   static void name_cache_used(struct send_ctx *sctx, struct name_cache_entry *nce)
> >   {
> > -	list_del(&nce->list);
> > -	list_add_tail(&nce->list, &sctx->name_cache_list);
> > +	list_move_tail(&nce->list, &sctx->name_cache_list);
> >   }
> 
> 
>   Looks good.
>   You can consider open-code name_cache_used() as there is only one user.

Yeah sounds like a good idea, with part of the function comment next to
the list_move_tail.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] btrfs: send: use list_move_tail instead of list_del/list_add_tail
  2021-06-08 14:12   ` David Sterba
@ 2021-06-11  6:05     ` libaokun (A)
  0 siblings, 0 replies; 4+ messages in thread
From: libaokun (A) @ 2021-06-11  6:05 UTC (permalink / raw)
  To: dsterba, Anand Jain, linux-kernel, Chris Mason, Josef Bacik,
	David Sterba, weiyongjun1, yuehaibing, yangjihong1, yukuai3,
	linux-btrfs, kernel-janitors, Hulk Robot

Thank you for your advice.

I'm about to send a patch v2 with the changes suggested by you.

Best Regards


在 2021/6/8 22:12, David Sterba 写道:
> On Tue, Jun 08, 2021 at 01:16:21PM +0800, Anand Jain wrote:
>> On 8/6/21 11:12 am, Baokun Li wrote:
>>> Using list_move_tail() instead of list_del() + list_add_tail().
>>>
>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>> Signed-off-by: Baokun Li <libaokun1@huawei.com>
>>> ---
>>>    fs/btrfs/send.c | 3 +--
>>>    1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
>>> index bd69db72acc5..a0e51b2416a1 100644
>>> --- a/fs/btrfs/send.c
>>> +++ b/fs/btrfs/send.c
>>> @@ -2083,8 +2083,7 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx,
>>>     */
>>>    static void name_cache_used(struct send_ctx *sctx, struct name_cache_entry *nce)
>>>    {
>>> -	list_del(&nce->list);
>>> -	list_add_tail(&nce->list, &sctx->name_cache_list);
>>> +	list_move_tail(&nce->list, &sctx->name_cache_list);
>>>    }
>>
>>    Looks good.
>>    You can consider open-code name_cache_used() as there is only one user.
> Yeah sounds like a good idea, with part of the function comment next to
> the list_move_tail.
> .

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-11  6:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08  3:12 [PATCH -next] btrfs: send: use list_move_tail instead of list_del/list_add_tail Baokun Li
2021-06-08  5:16 ` Anand Jain
2021-06-08 14:12   ` David Sterba
2021-06-11  6:05     ` libaokun (A)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).