All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: majianpeng <majianpeng@gmail.com>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH 4/4] raid1: Rewrite the implementation of iobarrier.
Date: Fri, 15 Nov 2013 14:42:11 +1100	[thread overview]
Message-ID: <20131115144211.5ac78deb@notabene.brown> (raw)
In-Reply-To: <201311151029513246491@gmail.com>

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

On Fri, 15 Nov 2013 10:29:56 +0800 majianpeng <majianpeng@gmail.com> wrote:

> >> Yes.How about those code:
> >> spin_lock_irq(&conf->resync_lock);
> >> retry_check:
> >>         if (need_to_wait_for_sync(conf, bio)) {
> >>                 conf->nr_waiting++;
> >>                 /* Wait for the barrier to drop.
> >>                  * However if there are already pending
> >>                  * requests (preventing the barrier from
> >>                  * rising completely), and the
> >>                  * pre-process bio queue isn't empty,
> >>                  * then don't wait, as we need to empty
> >>                  * that queue to get the nr_pending
> >>                  * count down.
> >>                  */
> >>                 wait_event_lock_irq(conf->wait_barrier,
> >>                                     !conf->array_frozen &&
> >>                                     (!conf->barrier ||
> >>                                     (conf->nr_pending &&
> >>                                      current->bio_list &&
> >>                                      !bio_list_empty(current->bio_list))),
> >>                                     conf->resync_lock);
> >>                 conf->nr_waiting--;
> >> 				goto retry_check;
> >> >
> >
> >It would look a lot better if you made it a while loop:
> >
> > while (need_to_wait....) {
> >     nr_waiting++
> >     wait_event.....
> >     nr_waiting--
> > if (bio_data_dir.....
> >
> For this, i think it don;t need while() or recheck.
> The code should:
> 
> if (nedd_to_wait...) {
> 	nr_waiting++
> 	wait_event.....
> 	nr_waiting--
> }
> if (bio && bio_data_dir(bio) == WRITE) {
> 	 do;
> }
> 
> I think again need_to_wait...(),it must return false. So we don't recheck this.
> Or am I missing something?
> 

An 'if' is fine.  I just didn't like the goto.
If you can send me the updated patch in a day or 2 I should be able to get it
into the current merge window.

thanks,
NeilBrown

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

  reply	other threads:[~2013-11-15  3:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-28 11:40 [PATCH 4/4] raid1: Rewrite the implementation of iobarrier majianpeng
2013-10-24  1:50 ` NeilBrown
2013-10-29  1:30   ` majianpeng
2013-10-31  2:33     ` NeilBrown
2013-10-31  3:20       ` majianpeng
2013-11-14  6:44         ` NeilBrown
2013-11-15  2:29           ` majianpeng
2013-11-15  3:42             ` NeilBrown [this message]
2013-11-15  6:55               ` majianpeng
2013-11-19  4:25                 ` NeilBrown
2013-11-19  7:53                   ` majianpeng

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=20131115144211.5ac78deb@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=majianpeng@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.