All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Dongsheng Yang <dongsheng.yang@easystack.cn>
Cc: Dongsheng Yang <dongsheng081251@gmail.com>,
	fabf@skynet.be, jesper.nilsson@axis.com,
	Dongsheng Yang <yangds.fnst@cn.fujitsu.com>,
	linux-cris-kernel@axis.com, shengyong1@huawei.com,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	richard <richard@nod.at>,
	dmitry.torokhov@gmail.com, dooooongsheng.yang@gmail.com,
	jschultz@xes-inc.com, starvik@axis.com, mtownsend1973@gmail.com,
	linux-mtd@lists.infradead.org,
	Colin King <colin.king@canonical.com>,
	asierra@xes-inc.com, Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: MTD RAID
Date: Fri, 19 Aug 2016 10:20:16 +0200	[thread overview]
Message-ID: <20160819102016.0640b6d5@bbrezillon> (raw)
In-Reply-To: <57B6B073.9060404@easystack.cn>

On Fri, 19 Aug 2016 15:08:35 +0800
Dongsheng Yang <dongsheng.yang@easystack.cn> wrote:

> On 08/19/2016 02:49 PM, Boris Brezillon wrote:
> > Hi Dongsheng,
> >
> > On Fri, 19 Aug 2016 14:34:54 +0800
> > Dongsheng Yang <dongsheng081251@gmail.com> wrote:
> >  
> >> Hi guys,
> >>      This is a email about MTD RAID.
> >>
> >> *Code:*
> >>      kernel:
> >> https://github.com/yangdongsheng/linux/tree/mtd_raid_v2-for-4.7  
> > Just had a quick look at the code, and I see at least one major problem
> > in your RAID-1 implementation: you're ignoring the fact that NAND blocks
> > can be or become bad. What's the plan for that?  
> 
> Hi Boris,
>      Thanx for your quick reply.
> 
>      When you are using RAID-1, it would erase the all mirrored blockes 
> when you are erasing.
> if there is a bad block in them, mtd_raid_erase will return an error and 
> the userspace tool
> or ubi will mark this block as bad, that means, the 
> mtd_raid_block_markbad() will mark the all
>   mirrored blocks as bad, although some of it are good.
> 
> In addition, when you have data in flash with RAID-1, if one block 
> become bad. For example,
> when the mtd0 and mtd1 are used to build a RAID-1 device mtd2. When you 
> are using mtd2
> and you found there is a block become bad. Don't worry about data 
> losing, the data is still
> saved in the good one mirror. you can replace the bad one device with 
> another new mtd device.

Okay, good to see you were aware of this problem.

> 
> My plan about this feature is all on the userspace tool.
> (1). mtd_raid scan mtd2 <---- this will show the status of RAID device 
> and each member of it.
> (2). mtd_raid replace mtd2 --old mtd1 --new mtd3.   <---- this will 
> replace the bad one mtd1 with mtd3.
> 
> What about this idea?

Not sure I follow you on #2. And, IMO, you should not depend on a
userspace tool to detect address this kind of problems.

Okay, a few more questions.

1/ What about data retention issues? Say you read from the main MTD, and
it does not show uncorrectable errors, so you keep reading on it, but,
since you're never reading from the mirror, you can't detect if there
are some uncorrectable errors or if the number of bitflips exceed the
threshold used to trigger a data move. If suddenly a page in your main
MTD becomes unreadable, you're not guaranteed that the mirror page will
be valid :-/.

2/ How do you handle write atomicity in RAID1? I don't know exactly
how RAID1 works, but I guess there's a mechanism (a journal?) to detect
that data has been written on the main MTD but not on the mirror, so
that you can replay the operation after a power-cut. Do handle this
case correctly?

On a general note, I don't think it's wise to place the RAID layer at
the MTD level. How about placing it at the UBI level (pick 2 ubi
volumes to create one UBI-RAID element)? This way you don't have to
bother about bad block handling (you're manipulating logical blocks
which can be anywhere on the NAND).

One last question? What's the real goal of this MTD-RAID layer? If
that's about addressing the MLC/TLC NAND reliability problems, I don't
think it's such a good idea.

Regards,

Boris

  parent reply	other threads:[~2016-08-19  8:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA+qeAOpuZ0CXZP8tCWdhoVvTEKAw26gtz63-UJmQ4XLSXAd=Yg@mail.gmail.com>
2016-08-19  6:49 ` MTD RAID Boris Brezillon
2016-08-19  7:08   ` Dongsheng Yang
2016-08-19  7:15     ` Dongsheng Yang
2016-08-19  7:28       ` Dongsheng Yang
2016-08-19  8:20     ` Boris Brezillon [this message]
     [not found]       ` <CA+qeAOrSAi9uTHGCi-5cAJpM_O45oJUihNP-rHHa1FWL7_ZKHQ@mail.gmail.com>
2016-08-19  9:37         ` Boris Brezillon
2016-08-19 10:22           ` Dongsheng Yang
2016-08-19 11:36             ` Boris Brezillon
     [not found]       ` <57B6CC7B.1060208@easystack.cn>
2016-08-19  9:47         ` Richard Weinberger
2016-08-19 10:30           ` Dongsheng Yang
2016-08-19 10:30           ` Artem Bityutskiy
2016-08-19 10:38             ` Dongsheng Yang
     [not found]               ` <AL*AZwAyAecQSM1UjjjNxao0.3.1471605640762.Hmail.dongsheng.yang@easystack.cn>
2016-08-19 11:55                 ` Boris Brezillon
2016-08-22  4:01                   ` Dongsheng Yang
2016-08-22  7:09                     ` Boris Brezillon
     [not found]                   ` <57BA6FFA.6000601@easystack.cn>
2016-08-22  7:07                     ` Boris Brezillon
2016-08-22  7:27                     ` Artem Bityutskiy
     [not found]                       ` <CAAp9bSh-geStbHpA6+vYdLfNLcinWkfVLOGmX4kdRbja+d2MdA@mail.gmail.com>
2016-08-22 14:54                         ` Artem Bityutskiy
2016-08-22 15:30                           ` David Woodhouse
2016-08-23  3:44   ` Dongsheng Yang

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=20160819102016.0640b6d5@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=asierra@xes-inc.com \
    --cc=colin.king@canonical.com \
    --cc=computersforpeace@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dongsheng.yang@easystack.cn \
    --cc=dongsheng081251@gmail.com \
    --cc=dooooongsheng.yang@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=fabf@skynet.be \
    --cc=jesper.nilsson@axis.com \
    --cc=jschultz@xes-inc.com \
    --cc=linux-cris-kernel@axis.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mtownsend1973@gmail.com \
    --cc=richard@nod.at \
    --cc=shengyong1@huawei.com \
    --cc=starvik@axis.com \
    --cc=yangds.fnst@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.