Linux-Raid Archives on lore.kernel.org
 help / color / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Xiao Ni <xni@redhat.com>
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: Wed, 3 Feb 2021 15:50:51 +0000
Message-ID: <20210203155051.GD4078626@infradead.org> (raw)
In-Reply-To: <1612359931-24209-5-git-send-email-xni@redhat.com>

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.

> +		/* 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 *.

  reply index

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 13:45 [PATCH 0/5] md/raid10: Improve handling " 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 [this message]
2021-02-04  2:00     ` Xiao Ni
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=20210203155051.GD4078626@infradead.org \
    --to=hch@infradead.org \
    --cc=colyli@suse.de \
    --cc=guoqing.jiang@cloud.ionos.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=matthew.ruffell@canonical.com \
    --cc=ncroxon@redhat.com \
    --cc=songliubraving@fb.com \
    --cc=xni@redhat.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

Linux-Raid Archives on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-raid/0 linux-raid/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-raid linux-raid/ https://lore.kernel.org/linux-raid \
		linux-raid@vger.kernel.org
	public-inbox-index linux-raid

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-raid


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git