linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: enable repair during read for raid56 profile
Date: Tue, 28 Mar 2017 21:36:31 -0700	[thread overview]
Message-ID: <20170329043631.GA306@lim.localdomain> (raw)
In-Reply-To: <20170327165944.GK4781@twin.jikos.cz>

On Mon, Mar 27, 2017 at 06:59:44PM +0200, David Sterba wrote:
> On Fri, Mar 24, 2017 at 12:13:35PM -0700, Liu Bo wrote:
> > Now that scrub can fix data errors with the help of parity for raid56
> > profile, repair during read is able to as well.
> > 
> > Although the mirror num in raid56 senario has different meanings, i.e.
> 
> (typo: scenario)
>

Thanks!

> > 0 or 1: read data directly
> > > 1:    do recover with parity,
> > it could be fit into how we repair bad block during read.
> 
> Could we possibly add some symbolic names for the RAID56 case?
>

Yes, we could do that here, but I'm afraid it might not be helpful
because most of places still use mirror or mirror_num, such as
btrfs_submit_bio_hook and btrfs_map_bio.

> > 
> > The trick is to use BTRFS_MAP_READ instead of BTRFS_MAP_WRITE to get the
> > device and position on it.
> 
> Please also document the trick in the code before the following.
>

Good point.

Thanks,

-liubo
> > +	if (btrfs_is_parity_mirror(map_tree, logical, length, mirror_num)) {
> > +		/* use BTRFS_MAP_READ to get the phy dev and sector */
> > +		ret = btrfs_map_block(fs_info, BTRFS_MAP_READ, logical,
> > +				      &map_length, &bbio, 0);
> > +		if (ret) {
> > +			btrfs_bio_counter_dec(fs_info);
> > +			bio_put(bio);
> > +			return -EIO;
> > +		}
> > +		ASSERT(bbio->mirror_num == 1);
> > +	} else {
> > +		ret = btrfs_map_block(fs_info, BTRFS_MAP_WRITE, logical,
> > +				      &map_length, &bbio, mirror_num);
> > +		if (ret) {
> > +			btrfs_bio_counter_dec(fs_info);
> > +			bio_put(bio);
> > +			return -EIO;
> > +		}
> > +		BUG_ON(mirror_num != bbio->mirror_num);
> >  	}
> > -	BUG_ON(mirror_num != bbio->mirror_num);
> > -	sector = bbio->stripes[mirror_num-1].physical >> 9;
> > +
> > +	sector = bbio->stripes[bbio->mirror_num - 1].physical >> 9;
> >  	bio->bi_iter.bi_sector = sector;
> > -	dev = bbio->stripes[mirror_num-1].dev;
> > +	dev = bbio->stripes[bbio->mirror_num - 1].dev;
> >  	btrfs_put_bbio(bbio);
> >  	if (!dev || !dev->bdev || !dev->writeable) {
> >  		btrfs_bio_counter_dec(fs_info);

  reply	other threads:[~2017-03-29  4:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24 19:13 [PATCH] Btrfs: enable repair during read for raid56 profile Liu Bo
2017-03-27 16:59 ` David Sterba
2017-03-29  4:36   ` Liu Bo [this message]
2017-03-29 17:53 ` [PATCH v2] " Liu Bo
2017-03-31  1:14   ` [PATCH v2] Btrfs: fix wrong failed mirror_num of read-repair on raid56 Qu Wenruo
2017-03-31  1:21     ` Qu Wenruo

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=20170329043631.GA306@lim.localdomain \
    --to=bo.li.liu@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /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).