linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Tom De Mulder <tdm27@cam.ac.uk>
Cc: "Mathias Burén" <mathias.buren@gmail.com>, linux-raid@vger.kernel.org
Subject: Re: Software RAID and TRIM
Date: Wed, 29 Jun 2011 20:45:19 +1000	[thread overview]
Message-ID: <20110629204519.419474d2@notabene.brown> (raw)
In-Reply-To: <alpine.OSX.2.00.1106291119200.257@trogdor.csi.cam.ac.uk>

On Wed, 29 Jun 2011 11:32:55 +0100 (BST) Tom De Mulder <tdm27@cam.ac.uk>
wrote:

> On Tue, 28 Jun 2011, Mathias Burén wrote:
> 
> > IIRC md can already pass TRIM down, but I think the filesystem needs
> > to know about the underlying architecture, or something, for TRIM to
> > work in RAID.
> 
> Yes, it's (usually/ideally) the filesystem's job to invoke the TRIM 
> command, and that's what ext4 can do. I have it working just fine on 
> single drives, but for reasons of service reliability would need to get 
> RAID to work.
> 
> I tried (on an admittedly vanilla Ubuntu 2.6.38 kernel) the same on a two 
> drive RAID1 md and it definitely didn't work (the blocks didn't get marked 
> as unused and zeroed).
> 
> > There's numerous discussions on this in the archives of
> > this mailing list.
> 
> Given how fast things move in the world of SSDs at the moment, I wanted to 
> check if any progress was made since. :-) I don't seem to be able to find 
> any reference to this in recent kernel source commits (but I'm a complete 
> amateur when it comes to git).


Trim support for md is a long way down my list of interesting projects (and
no-one else has volunteered).

It is not at all straight forward to implement.

For stripe/parity RAID, (RAID4/5/6) it is only safe to discard full stripes at
a time, and the md layer would need to keep a record of which stripes had been
discarded so that it didn't risk trusting data (and parity) read from those
stripes.  So you would need some sort of bitmap of invalid stripes, and you
would need the fs to discard in very large chunks for it to be useful at all.

For copying RAID (RAID1, RAID10) you really need the same bitmap.  There
isn't the same risk of reading and trusting discarded parity, but a resync
which didn't know about discarded ranges would undo the discard for you.

So is basically requires another bitmap to be stored with the metadata, and a
fairly fine-grained bitmap it would need to be.  Then every read and resync
checks the bitmap and ignores or returns 0 for discarded ranges, and every
write needs to check and if the range was discard, clear the bit and write to
the whole range.

So: do-able, but definitely non-trivial.

NeilBrown
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-06-29 10:45 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-28 15:31 Software RAID and TRIM Tom De Mulder
2011-06-28 16:11 ` Mathias Burén
2011-06-29 10:32   ` Tom De Mulder
2011-06-29 10:45     ` NeilBrown [this message]
2011-06-29 11:10       ` Tom De Mulder
2011-06-29 11:48         ` Scott E. Armitage
2011-06-29 12:46           ` Roberto Spadim
2011-06-29 12:46       ` David Brown
2011-06-30  0:28         ` NeilBrown
2011-06-30  7:50           ` David Brown
2011-06-29 13:39       ` Namhyung Kim
2011-06-30  0:27         ` NeilBrown
2011-07-17 22:11       ` Lutz Vieweg
2011-07-17 21:57     ` Lutz Vieweg
2011-06-29 10:33   ` Tom De Mulder
2011-06-29 12:42     ` David Brown
2011-06-29 12:55       ` Tom De Mulder
2011-06-29 13:02         ` Roberto Spadim
2011-06-29 13:10         ` David Brown
2011-06-30  5:51         ` Mikael Abrahamsson
2011-07-04  9:13           ` Tom De Mulder
2011-07-04 16:26             ` Werner Fischer
2011-07-17 22:31               ` Lutz Vieweg
2011-07-17 22:16         ` Lutz Vieweg
2011-07-17 22:00     ` Lutz Vieweg
2011-06-28 16:17 ` Johannes Truschnigg
2011-06-28 16:40 ` David Brown
2011-07-17 21:52   ` Lutz Vieweg
2011-07-18  5:14     ` Mikael Abrahamsson
2011-07-18 10:35     ` David Brown
2011-07-18 10:48       ` Tom De Mulder
2011-07-18 18:09       ` Lutz Vieweg
2011-07-18 20:18         ` David Brown
2011-07-19  9:29           ` Lutz Vieweg
2011-07-19 10:22             ` David Brown
2011-07-19 13:41               ` Lutz Vieweg
2011-07-19 15:06                 ` David Brown
2011-07-20 10:39                   ` Lutz Vieweg
2011-07-19 14:19               ` Tom De Mulder
2011-07-20  7:42                 ` David Brown
2011-07-20 12:20                   ` Lutz Vieweg
2011-07-20 12:13                 ` Werner Fischer
2011-07-20 12:25                   ` Lutz Vieweg
2011-07-18 10:53     ` Tom De Mulder
2011-07-18 12:13       ` Werner Fischer

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=20110629204519.419474d2@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=mathias.buren@gmail.com \
    --cc=tdm27@cam.ac.uk \
    /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).