Linux RAID subsystem development
 help / color / mirror / Atom feed
From: David Brown <david.brown@hesbynett.no>
To: "Scott E. Armitage" <launchpad@scott.armitage.name>
Cc: Bar Ziony <bartzy@gmail.com>, linux-raid@vger.kernel.org
Subject: Re: Does mdadm supports TRIM command to SSDs?
Date: Wed, 11 Jul 2012 17:08:28 +0200	[thread overview]
Message-ID: <4FFD96EC.2020007@hesbynett.no> (raw)
In-Reply-To: <CAA8Hn0eWuHJy9ivmvUVc-m=2t+L2_ACTy52tGVOYnFy97XFTXA@mail.gmail.com>

On 07/11/2012 01:58 PM, Scott E. Armitage wrote:
> On Wed, Jul 11, 2012 at 7:27 AM, David Brown <david.brown@hesbynett.no
> <mailto:david.brown@hesbynett.no>> wrote:
>
>     The big question here is /why/ would you want TRIM support?  In many
>     circumstances it leads to slower operations, and for SSDs from the
>     past couple of years it is almost entirely superseded by the SSD's
>     own garbage collection.
>
>
> Are you speaking from a general usage standpoint, or from a TRIM + RAID
> standpoint? For the general usage case, I was under the impression that
> SSD garbage collection was hamstrung by insufficient knowledge about
> which blocks are and are not in use. E.g. when a filesystem deletes a
> large file simply by marking it as deleted in the
> filetable/inode/whatever that particular system uses, the SSD is forced
> to carry around (and re-copy, if necessary) the data blocks until the
> filesystem tells it those blocks are no longer in use (i.e. a TRIM command).
>

That is correct - except that "hamstrung" is an exaggeration.  Blocks 
that are unused by the filesystem still have to be carried around by the 
SSD if they are not TRIM'ed, and that is extra work.  But it is not 
actually a great deal of extra work.  In particular, filesystems do a 
lot of re-use of deleted blocks - when the logical block is re-written, 
the SSD knows that the old data is no longer needed.

The main purpose of TRIM, and the reason it was introduced, was not so 
much to avoid moving around unneeded copies of old data, but to make 
sure there are free erased blocks available when they are needed.  With 
modern SSDs with over-provisioning and better garbage collection, that 
is no longer necessary - there are always free blocks, since there are 
many more physical blocks than logical ones.

If TRIM were well implemented, then it could still have been useful. 
But it is a synchronous command, and cannot be queued - this means it is 
slow, and breaks the flow of commands.  So the result is that operations 
such as "delete" can take many times longer to complete if TRIM is enabled.


  parent reply	other threads:[~2012-07-11 15:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10 22:55 Does mdadm supports TRIM command to SSDs? Bar Ziony
2012-07-11  0:43 ` Igor M Podlesny
2012-07-11  1:08   ` Igor M Podlesny
2012-07-11  7:59     ` Bar Ziony
2012-07-11 11:27 ` David Brown
2012-07-11 11:49   ` Bar Ziony
2012-07-11 14:54     ` David Brown
     [not found]   ` <CAA8Hn0eWuHJy9ivmvUVc-m=2t+L2_ACTy52tGVOYnFy97XFTXA@mail.gmail.com>
2012-07-11 15:08     ` David Brown [this message]
2012-07-11 16:21   ` Bernd Schubert
2012-07-11 16:22     ` Bar Ziony
2012-07-11 16:44       ` Bernd Schubert

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=4FFD96EC.2020007@hesbynett.no \
    --to=david.brown@hesbynett.no \
    --cc=bartzy@gmail.com \
    --cc=launchpad@scott.armitage.name \
    --cc=linux-raid@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