linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shaohua Li <shli@kernel.org>
To: Guoqing Jiang <gqjiang@suse.com>
Cc: linux-raid@vger.kernel.org, shli@fb.com, neilb@suse.com
Subject: Re: [RFC PATCH] md/raid10: refactor some codes from raid10_write_request
Date: Wed, 15 Mar 2017 15:46:48 -0700	[thread overview]
Message-ID: <20170315224648.g77w3nt23weycrhy@kernel.org> (raw)
In-Reply-To: <58C8AED4.5020309@suse.com>

On Wed, Mar 15, 2017 at 11:02:44AM +0800, Guoqing Jiang wrote:
> 
> 
> On 03/15/2017 12:48 AM, Shaohua Li wrote:
> > On Mon, Mar 13, 2017 at 05:23:59PM +0800, Guoqing Jiang wrote:
> > > Previously, we clone both bio and repl_bio in raid10_write_request,
> > > then add the cloned bio to plug->pending or conf->pending_bio_list
> > > based on plug or not, and most of the logics are same for the two
> > > conditions.
> > > 
> > > So introduce handle_clonebio (a better name is welcome) for it, and
> > > use replacement parameter to distinguish the difference. No functional
> > > changes in the patch.
> > > 
> > > Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
> > > ---
> > > Another reason for it is to improve the readability of code, but
> > > I didn't touch raid10 before so this is labeled as RFC.
> > > 
> > >   drivers/md/raid10.c | 172 ++++++++++++++++++++++------------------------------
> > >   1 file changed, 72 insertions(+), 100 deletions(-)
> > > 
> > > diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> > > index b1b1f982a722..02d8eff8d26e 100644
> > > --- a/drivers/md/raid10.c
> > > +++ b/drivers/md/raid10.c
> > > @@ -1188,18 +1188,81 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
> > >   	return;
> > >   }
> > > -static void raid10_write_request(struct mddev *mddev, struct bio *bio,
> > > -				 struct r10bio *r10_bio)
> > > +static void handle_clonebio(struct mddev *mddev, struct r10bio *r10_bio,
> > > +			    struct bio *bio, int i, int replacement,
> > > +			    int max_sectors)
> > Maybe raid10_write_one_disk?
> 
> Thanks for review, I will use it unless a better name is found.
> 
> >   Please replace 'i' with a meaningful name and
> > change to 'boo' for replacement.
> 
> Ok, I would replace 'i' with 'n_copy', what is the meaning of 'boo'?
> IMO, replacement fits better here, thanks.

sorry, I mean 'bool'
 
> +		if (r10_bio->devs[i].bio)
> +			handle_clonebio(mddev, r10_bio, bio, i, 0, max_sectors);
> +		if (r10_bio->devs[i].repl_bio)
> +			handle_clonebio(mddev, r10_bio, bio, i, 1, max_sectors);
> 
> 
> 
> Regards,
> Guoqing
> 
> 

      reply	other threads:[~2017-03-15 22:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13  9:23 [RFC PATCH] md/raid10: refactor some codes from raid10_write_request Guoqing Jiang
2017-03-14 16:48 ` Shaohua Li
2017-03-15  3:02   ` Guoqing Jiang
2017-03-15 22:46     ` Shaohua Li [this message]

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=20170315224648.g77w3nt23weycrhy@kernel.org \
    --to=shli@kernel.org \
    --cc=gqjiang@suse.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.com \
    --cc=shli@fb.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;
as well as URLs for NNTP newsgroup(s).