Re: [PATCH] jfs: Simplify code

From: Dave Kleikamp
Date: Tue Sep 06 2016 - 13:24:53 EST


On 09/03/2016 12:35 AM, Christophe JAILLET wrote:
> Calling 'list_splice' followed by 'INIT_LIST_HEAD' is equivalent to
> 'list_splice_init'.

Looks good. I'll push this upstream.

>
> This has been spotted with the following coccinelle script:
> /////
> @@
> expression y,z;
> @@
>
> - list_splice(y,z);
> - INIT_LIST_HEAD(y);
> + list_splice_init(y,z);
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
Signed-off-by: Dave Kleikamp <dave.kleikamp@xxxxxxxxxx>

> ---
> fs/jfs/jfs_txnmgr.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
> index 2e58978d6f45..4d973524c887 100644
> --- a/fs/jfs/jfs_txnmgr.c
> +++ b/fs/jfs/jfs_txnmgr.c
> @@ -2893,8 +2893,7 @@ restart:
> * on anon_list2. Let's check.
> */
> if (!list_empty(&TxAnchor.anon_list2)) {
> - list_splice(&TxAnchor.anon_list2, &TxAnchor.anon_list);
> - INIT_LIST_HEAD(&TxAnchor.anon_list2);
> + list_splice_init(&TxAnchor.anon_list2, &TxAnchor.anon_list);
> goto restart;
> }
> TXN_UNLOCK();
>