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 2/5] md/raid10: extend r10bio devs to raid disks
Date: Wed, 3 Feb 2021 15:44:53 +0000
Message-ID: <20210203154453.GB4078626@infradead.org> (raw)
In-Reply-To: <1612359931-24209-3-git-send-email-xni@redhat.com>

On Wed, Feb 03, 2021 at 09:45:28PM +0800, Xiao Ni wrote:
> Now it allocs r10bio->devs[conf->copies]. Discard bio needs to submit
> to all member disks and it needs to use r10bio. So extend to
> r10bio->devs[geo.raid_disks].
> 
> Reviewed-by: Coly Li <colyli@suse.de>
> Signed-off-by: Xiao Ni <xni@redhat.com>
> ---
>  drivers/md/raid10.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index be8f14a..891b249 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -91,7 +91,7 @@ static inline struct r10bio *get_resync_r10bio(struct bio *bio)
>  static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data)
>  {
>  	struct r10conf *conf = data;
> -	int size = offsetof(struct r10bio, devs[conf->copies]);
> +	int size = offsetof(struct r10bio, devs[conf->geo.raid_disks]);
>  
>  	/* allocate a r10bio with room for raid_disks entries in the
>  	 * bios array */
> @@ -238,7 +238,7 @@ static void put_all_bios(struct r10conf *conf, struct r10bio *r10_bio)
>  {
>  	int i;
>  
> -	for (i = 0; i < conf->copies; i++) {
> +	for (i = 0; i < conf->geo.raid_disks; i++) {
>  		struct bio **bio = & r10_bio->devs[i].bio;
>  		if (!BIO_SPECIAL(*bio))
>  			bio_put(*bio);
> @@ -327,7 +327,7 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
>  	int slot;
>  	int repl = 0;
>  
> -	for (slot = 0; slot < conf->copies; slot++) {
> +	for (slot = 0; slot < conf->geo.raid_disks; slot++) {
>  		if (r10_bio->devs[slot].bio == bio)
>  			break;
>  		if (r10_bio->devs[slot].repl_bio == bio) {
> @@ -336,7 +336,6 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
>  		}
>  	}
>  
> -	BUG_ON(slot == conf->copies);
>  	update_head_pos(slot, r10_bio);
>  
>  	if (slotp)
> @@ -1492,7 +1491,7 @@ static void __make_request(struct mddev *mddev, struct bio *bio, int sectors)
>  	r10_bio->sector = bio->bi_iter.bi_sector;
>  	r10_bio->state = 0;
>  	r10_bio->read_slot = -1;
> -	memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) * conf->copies);
> +	memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) * conf->geo.raid_disks);

Please avoid the overly long line.

  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 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 [this message]
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
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=20210203154453.GB4078626@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