linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiao Ni <xni@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: songliubraving@fb.com, linux-raid@vger.kernel.org,
	matthew.ruffell@canonical.com, colyli@suse.de,
	guoqing.jiang@cloud.ionos.com, ncroxon@redhat.com
Subject: Re: [PATCH 4/5] md/raid10: improve raid10 discard request
Date: Thu, 4 Feb 2021 10:00:07 +0800	[thread overview]
Message-ID: <32522765-973f-8381-75a9-c8386dd44528@redhat.com> (raw)
In-Reply-To: <20210203155051.GD4078626@infradead.org>



On 02/03/2021 11:50 PM, Christoph Hellwig wrote:
> On Wed, Feb 03, 2021 at 09:45:30PM +0800, Xiao Ni wrote:
>> +static struct bio *raid10_split_bio(struct r10conf *conf,
>> +			struct bio *bio, sector_t sectors, bool want_first)
>> +{
>> +	struct bio *split;
>> +
>> +	split = bio_split(bio, sectors,	GFP_NOIO, &conf->bio_split);
>> +	bio_chain(split, bio);
>> +	allow_barrier(conf);
>> +	if (want_first) {
>> +		submit_bio_noacct(bio);
>> +		bio = split;
>> +	} else
>> +		submit_bio_noacct(split);
>> +	wait_barrier(conf);
>> +
>> +	return bio;
> I'm not sure this helper makes much sense given that the two different
> cases could just be open coded into the two callers.
It makes sense. At first I want to make the codes look like simpler. But 
as you said, they are two
different cases. We can code openly into the two callers.
>
>> +		/* raid10_remove_disk uses smp_mb to make sure rdev is set to
>> +		 * replacement before setting replacement to NULL. It can read
>> +		 * rdev first without barrier protect even replacment is NULL
>> +		 */
> Not the normal kernel comment style.
>
>> +/* There are some limitations to handle discard bio
>> + * 1st, the discard size is bigger than stripe_size*2.
>> + * 2st, if the discard bio spans reshape progress, we use the old way to
>> + * handle discard bio
>> + */
> Same here.
>
>> +static int raid10_handle_discard(struct mddev *mddev, struct bio *bio)
>> +{
>> +	struct r10conf *conf = mddev->private;
>> +	struct geom *geo = &conf->geo;
>> +	struct r10bio *r10_bio;
>> +
>> +	int disk;
>> +	sector_t chunk;
>> +	unsigned int stripe_size;
>> +	unsigned int stripe_data_disks;
>> +	sector_t split_size;
>> +
>> +	sector_t bio_start, bio_end;
> Empty lines between variabe declarations also are kinda strange.
>
>> +	stripe_data_disks = geo->near_copies ?
>> +				geo->raid_disks / geo->near_copies +
>> +				geo->raid_disks % geo->near_copies :
>> +				geo->raid_disks;
> Normal style would be an if/else here.
>
>> +
>> +	bio_start = bio->bi_iter.bi_sector;
>> +	bio_end = bio_end_sector(bio);
>> +
>> +	/* Maybe one discard bio is smaller than strip size or across one stripe
>> +	 * and discard region is larger than one stripe size. For far offset layout,
> While there are occasional exceptions to the 80 char line rule, a block
> comment should never qualify.
>
>> +	 * if the discard region is not aligned with stripe size, there is hole
>> +	 * when we submit discard bio to member disk. For simplicity, we only
>> +	 * handle discard bio which discard region is bigger than stripe_size*2
>> +	 */
>> +	if (bio_sectors(bio) < stripe_size*2)
> missing whitespaces around the *.
>
I'll fix these style problems.

Thanks
Xiao


  reply	other threads:[~2021-02-04  2:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 13:45 [PATCH 0/5] md/raid10: Improve handling raid10 discard request Xiao Ni
2021-02-03 13:45 ` [PATCH 1/5] md: add md_submit_discard_bio() for submitting discard bio Xiao Ni
2021-02-03 15:44   ` Christoph Hellwig
2021-02-04  1:51     ` Xiao Ni
2021-02-04  4:07     ` Xiao Ni
2021-02-04  7:19       ` Christoph Hellwig
2021-02-04  7:37         ` Xiao Ni
2021-02-03 13:45 ` [PATCH 2/5] md/raid10: extend r10bio devs to raid disks Xiao Ni
2021-02-03 15:44   ` Christoph Hellwig
2021-02-03 13:45 ` [PATCH 3/5] md/raid10: pull codes that wait for blocked dev into one function Xiao Ni
2021-02-03 15:46   ` Christoph Hellwig
2021-02-04  1:54     ` Xiao Ni
2021-02-03 13:45 ` [PATCH 4/5] md/raid10: improve raid10 discard request Xiao Ni
2021-02-03 15:50   ` Christoph Hellwig
2021-02-04  2:00     ` Xiao Ni [this message]
2021-02-03 13:45 ` [PATCH 5/5] md/raid10: improve discard request for far layout Xiao Ni

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=32522765-973f-8381-75a9-c8386dd44528@redhat.com \
    --to=xni@redhat.com \
    --cc=colyli@suse.de \
    --cc=guoqing.jiang@cloud.ionos.com \
    --cc=hch@infradead.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=matthew.ruffell@canonical.com \
    --cc=ncroxon@redhat.com \
    --cc=songliubraving@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).