All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jes Sorensen <jes.sorensen@gmail.com>
To: Shaohua Li <shli@kernel.org>, NeilBrown <neilb@suse.com>
Cc: linux-raid@vger.kernel.org, neilb@suse.de
Subject: Re: RAID creation resync behaviors
Date: Tue, 9 May 2017 14:39:23 -0400	[thread overview]
Message-ID: <1fca5ff4-358a-e0cf-d1a4-fc33ecdcbd62@gmail.com> (raw)
In-Reply-To: <20170504020452.kcmjgxnk7zsx7kdx@kernel.org>

On 05/03/2017 10:04 PM, Shaohua Li wrote:
> On Thu, May 04, 2017 at 11:07:01AM +1000, Neil Brown wrote:
>> On Wed, May 03 2017, Shaohua Li wrote:
>>
>>> Hi,
>>>
>>> Currently we have different resync behaviors in array creation.
>>>
>>> - raid1: copy data from disk 0 to disk 1 (overwrite)
>>> - raid10: read both disks, compare and write if there is difference (compare-write)
>>> - raid4/5: read first n-1 disks, calculate parity and then write parity to the last disk (overwrite)
>>> - raid6: read all disks, calculate parity and compare, and write if there is difference (compare-write)
>>
>> The approach taken for raid1 and raid4/5 provides the fastest sync for
>> an array built on uninitialised spinning devices.
>> RAID6 could use the same approach but would involve more CPU and so
>> the original author of the RAID6 code (hpa) chose to go for the low-CPU
>> cost option.  I don't know if tests were done, or if they would still be
>> valid on new hardware.
>> The raid10 approach comes from "it is too hard to optimize in general
>> because different RAID10 layouts have different trade-offs, so just
>> take the easy way out."
> 
> ok, thanks for the explanation!
>>>
>>> Write whole disk is very unfriendly for SSD, because it reduces lifetime. And
>>> if user already does a trim before creation, the unncessary write could make
>>> SSD slower in the future. Could we prefer compare-write to overwrite if mdadm
>>> detects the disks are SSD? Surely sometimes compare-write is slower than
>>> overwrite, so maybe add new option in mdadm. An option to let mdadm trim SSD
>>> before creation sounds reasonable too.
>>
>> An option to ask mdadm to trim the data space and then --assume-clean
>> certainly sounds reasonable.
> 
> This doesn't work well. read returns 0 for trimmed data space in some SSDs, but
> not all. If not, we will have trouble.

/sys/block/<device>/queue/discard_zeroes_data

We could use this as an indicator for what to do.

Jes

  reply	other threads:[~2017-05-09 18:39 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-03 20:27 RAID creation resync behaviors Shaohua Li
2017-05-03 21:06 ` David Brown
2017-05-04  1:54   ` Shaohua Li
2017-05-04  7:37     ` David Brown
2017-05-04 16:02       ` Wols Lists
2017-05-04 21:57       ` NeilBrown
2017-05-05  6:46         ` David Brown
2017-05-04 15:50     ` Wols Lists
2017-05-04 22:00       ` NeilBrown
2017-05-03 23:58 ` Andreas Klauer
2017-05-04  2:22   ` Shaohua Li
2017-05-04  7:55     ` Andreas Klauer
2017-05-04  8:06       ` Roman Mamedov
2017-05-04 15:20       ` Brad Campbell
2017-05-04  1:07 ` NeilBrown
2017-05-04  2:04   ` Shaohua Li
2017-05-09 18:39     ` Jes Sorensen [this message]
2017-05-09 20:30       ` NeilBrown
2017-05-09 20:49         ` Jes Sorensen
2017-05-09 21:03           ` Martin K. Petersen
2017-05-09 21:11             ` Jes Sorensen
2017-05-09 21:16               ` Martin K. Petersen
2017-05-09 21:22                 ` Jes Sorensen
2017-05-09 23:56                   ` Martin K. Petersen
2017-05-10  5:58                   ` Hannes Reinecke
2017-05-10 22:20                     ` Martin K. Petersen
2017-05-10 17:30                   ` Shaohua Li

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=1fca5ff4-358a-e0cf-d1a4-fc33ecdcbd62@gmail.com \
    --to=jes.sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.com \
    --cc=neilb@suse.de \
    --cc=shli@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 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.