mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Byungchul Park <byungchul.park@lge.com>,
	peterz@infradead.org, mingo@kernel.org, koverstreet@google.com,
	neilb@suse.de, nab@linux-iscsi.org, viro@zeniv.linux.org.uk
Cc: ying.huang@intel.com, oleg@redhat.com, asias@redhat.com,
	shli@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] llist: Don't reinvent the wheel but use existing llist API
Date: Mon, 13 Feb 2017 15:56:08 +1100	[thread overview]
Message-ID: <87r3324rkn.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <1486959013-26105-1-git-send-email-byungchul.park@lge.com>

[-- Attachment #1: Type: text/plain, Size: 1632 bytes --]

On Mon, Feb 13 2017, Byungchul Park wrote:

> Although llist provides proper APIs, they are not used. Make them used.
>
> Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> ---
>  drivers/md/bcache/closure.c | 15 ++-------------
>  drivers/md/raid5.c          |  4 +---
>  drivers/vhost/scsi.c        |  9 ++-------
>  fs/file_table.c             | 12 +++++-------
>  fs/namespace.c              | 12 +++++-------
>  include/linux/llist.h       |  3 +++
>  kernel/irq_work.c           |  6 +-----
>  kernel/sched/core.c         | 13 ++-----------
>  mm/vmalloc.c                |  8 +++-----
>  9 files changed, 24 insertions(+), 58 deletions(-)
>
...

> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 36c13e4..c82243a 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -359,11 +359,9 @@ static int release_stripe_list(struct r5conf *conf,
>  
>  	head = llist_del_all(&conf->released_stripes);
>  	head = llist_reverse_order(head);
> -	while (head) {
> +	llist_for_each_entry(sh, head, release_list) {
>  		int hash;
>  
> -		sh = llist_entry(head, struct stripe_head, release_list);
> -		head = llist_next(head);
>  		/* sh could be readded after STRIPE_ON_RELEASE_LIST is cleard */
>  		smp_mb();
>  		clear_bit(STRIPE_ON_RELEASE_LIST, &sh->state);

This one is wrong (I haven't checked the rest).
As soon a STRIPE_ON_RELEASE_LIST is cleared, the llist_node can be
reused, so we need to call llist_next *before* the rest of the code.
You have moved the call to afterwards.

You could possibly change it to use llist_for_each_entry_safe()

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2017-02-13  4:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13  4:10 Byungchul Park
2017-02-13  4:56 ` NeilBrown [this message]
2017-02-13  5:14   ` Byungchul Park
2017-02-13  5:38 ` Huang, Ying
2017-02-13  5:55   ` Byungchul Park
2017-02-13  5:43 ` Al Viro
2017-02-13  6:00   ` Byungchul Park
2017-02-24  1:20 ` [lkp-robot] [llist] bc1a405b00: Kernel_panic-not_syncing:No_working_init_found kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r3324rkn.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=asias@redhat.com \
    --cc=byungchul.park@lge.com \
    --cc=koverstreet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=neilb@suse.de \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=shli@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®