All of lore.kernel.org
 help / color / mirror / Atom feed
From: "John Stoffel" <john@stoffel.org>
To: Robert LeBlanc <robert@leblancnet.us>
Cc: John Stoffel <john@stoffel.org>, linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH 1/2] md/raid1: Refactor raid1_make_request
Date: Thu, 1 Dec 2016 17:00:56 -0500	[thread overview]
Message-ID: <22592.40344.186084.537205@quad.stoffel.home> (raw)
In-Reply-To: <CAANLjFq2eezGRded8uDk6U0si_gt9j250qR4VQW+WFUeYJ70OA@mail.gmail.com>

>>>>> "Robert" == Robert LeBlanc <robert@leblancnet.us> writes:

Robert> On Thu, Dec 1, 2016 at 9:04 AM, John Stoffel <john@stoffel.org> wrote:
>> Maybe this is pedantic, but why not have an 'else' instead of the
>> return to make it more clear?  If someone (like me :-) missed the
>> return on the quick read through, it's going to be some confusion.
>> 
>> if (bio_data_dir(bio) == READ)
>> raid1_read_request(mddev, bui, r1_bio);
>> else
>> raid1_write_request(mddev, bio, r1_bio, start_next_window);
>> 
>> seems cleaner.

Robert> Yeah, I agree that is a bit cleaner, I was just following the
Robert> previous style. I'll change it to what you propose.

It's not a big deal, whatever makes you happy.  

>> Also, why are the calls different with the start_next_window parameter
>> added in?  Sorry for being dense, trying to understand the code
>> better...

Robert> start_next_windows is set by wait_barrier() and is only
Robert> non-zero for writes and the return value of zero is never used
Robert> for reads. I tried to move that code into the write branch,
Robert> but I could not unload the module due to conf->nr_pending ==
Robert> conf->queued+extra failing in wait_event_lock_irq_cmd() in
Robert> freeze_array(). Each read was decrementing conf->nr_pending
Robert> and since wait_barrier() was not being called on reads,
Robert> conf->nr_pending was very negative and would not return to
Robert> zero. In order to refactor that out completely would require a
Robert> lot more work and changes. I'd need to do more research into
Robert> how much the spin_locks are needed for reading when there is
Robert> recovery going on before I could start to try and refactor
Robert> that. The other option is to break wait_barrier() into two
Robert> functions, one that gets called for both read and write and
Robert> the other for just the writes. I can do the latter pretty
Robert> easily if that is a desired direction.

That second option might be the way to move forward.  But it sounds
like a bigger refactoring than is really needed now.

John

  reply	other threads:[~2016-12-01 22:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-30 21:20 [PATCH 0/2] Reorganize raid*_make_request to clean up code Robert LeBlanc
2016-11-30 21:20 ` [PATCH 1/2] md/raid1: Refactor raid1_make_request Robert LeBlanc
2016-12-01 16:04   ` John Stoffel
2016-12-01 17:40     ` Robert LeBlanc
2016-12-01 22:00       ` John Stoffel [this message]
2016-12-02  0:36   ` NeilBrown
2016-11-30 21:20 ` [PATCH 2/2] md/raid10: Refactor raid10_make_request Robert LeBlanc
2016-12-02  3:30 ` [PATCH v2 0/2] Reorganize raid*_make_request to clean up code Robert LeBlanc
2016-12-02  3:30   ` [PATCH v2 1/2] md/raid1: Refactor raid1_make_request Robert LeBlanc
2016-12-02  3:30   ` [PATCH v2 2/2] md/raid10: Refactor raid10_make_request Robert LeBlanc
2016-12-02 22:02     ` Shaohua Li

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=22592.40344.186084.537205@quad.stoffel.home \
    --to=john@stoffel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=robert@leblancnet.us \
    /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.