linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Jeff Layton <laytonjb@att.net>
Cc: Matthew Wilcox <matthew@wil.cx>,
	linux-fsdevel@vger.kernel.org,
	Linux IDE mailing list <linux-ide@vger.kernel.org>
Subject: Re: TRIM support in drivers and dm/md?
Date: Thu, 04 Nov 2010 16:23:35 -0400	[thread overview]
Message-ID: <4CD31647.7070301@garzik.org> (raw)
In-Reply-To: <4CD2F3E1.8040700@att.net>

On 11/04/2010 01:56 PM, Jeff Layton wrote:
>
>>>>> Do many of the SATA controllers support TRIM? (i.e. pass
>>>>> the TRIM command to the SSD). Does anyone know
>>>>> anything about dm/md supporting TRIM? (I'm thinking LVM
>>>>> and software RAID tools).
>>
>>>> As far as I know, there's nothing to be done in any SATA controller
>>>> driver to support TRIM. It's just up to the drive whether it
>>>> understands
>>>> the command.
>>
>>> That's the rub. I've heard that many drivers don't understand
>>> the command. So I'm curious what drivers do and any experience
>>> anyone might have.
>>
>> Note the distinction between "drive" and "driver"... I agree with what
>> Matthew says.
>>
>
> Oops - sorry I missed "drive" vs. "driver".
>
> I've heard from other places that drivers need to pass along
> the TRIM command to the drives but that many drivers don't
> do this. I assume that the best way to determine if this is
> accurate is to test the controller drivers or ping the maintainers.

I'd object to the words "many" and "drivers" :)

The general rule for all kernel SATA drivers is to support all ATA 
commands, including future, unknown commands not invented yet.

That's because kernel SATA drivers deal primarily with the 
sending/receiving from hardware an opaque data bundle -- the ATA 
taskfile -- rather than create a software system that requires new code 
in each driver, for each new ATA command.

That's the ideal and, if you obtained a SATA controller in the past 5 
years or so, your controller (ahci, sata_sil24, others) supports TRIM 
just fine because it is a generic ATA taskfile transport and nothing more.

Some now-uncommon controllers have problems with new ATA commands, 
either due to (a) they are complex, firmware-driven RAID-esque beasts, 
or (b) they have an internal command table.  And I imagine some early 
SATA<->PATA bridge chips probably get confused as well.  But those are 
the minority, and getting less frequent by the day.

Note in all of the above I say "controller" rather than "driver".  I 
know of no _driver_ that prevents TRIM, where the underlying controller 
hardware supports it.

For the controllers that don't support TRIM, the error behavior should 
be something predictable and consistent like a command abort.

	Jeff



  reply	other threads:[~2010-11-04 20:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04 13:19 TRIM support in drivers and dm/md? Jeff Layton
2010-11-04 13:40 ` Matthew Wilcox
2010-11-04 14:46   ` Jeff Layton
2010-11-04 16:45     ` Jeff Garzik
2010-11-04 17:56       ` Jeff Layton
2010-11-04 20:23         ` Jeff Garzik [this message]
2010-11-05  2:44           ` Mark Lord
2010-11-05  2:56             ` Jeff Garzik

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=4CD31647.7070301@garzik.org \
    --to=jeff@garzik.org \
    --cc=laytonjb@att.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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).