public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Phil Karn <karn@ka9q.net>
Cc: xfs@oss.sgi.com
Subject: Re: TRIM details
Date: Fri, 07 Jan 2011 11:50:09 -0500	[thread overview]
Message-ID: <yq1ei8oodz2.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <4D271F8D.3030404@ka9q.net> (Phil Karn's message of "Fri, 07 Jan 2011 06:13:33 -0800")

>>>>> "Phil" == Phil Karn <karn@ka9q.net> writes:

Phil> Oh, there's no question that an explicit TRIM command would be
Phil> *far* more efficient than an implicit TRIM that writes zeroes. If
Phil> nothing else, implicit TRIMming requires writing every single
Phil> sector individually, while the WRITE SAME command lets the host
Phil> wipe up to 65,536 (I think) sectors with a single command.

ATA does not have WRITE SAME. It's a SCSI command.

WRITE SAME(10) allows clearing 32MB per command on a device with
512-byte blocks. WRITE SAME(16) allows a bigger area but most drives
don't support it. Those that do often cap at 16-bits anyway (Note that
I'm talking about drives. Arrays are more flexible).

DSM TRIM allows you to clear 2GB per command with a 512-byte
payload. Several modern drives will let you clear 16GB with a 4KB
payload.


Phil> But that's not my point. My point is that if the drive could
Phil> recognize a write of 0s to a sector as an implicit TRIM, then it
Phil> would still be possible to manually trim the drive without any
Phil> support whatsoever from the device driver or file system.

But the fact remains that drives don't implement this. They do implement
DSM TRIM. Even if the drives did support zero detection we'd have no way
of getting the information to them short of sending a bazillion zeroes
down the pipe. And why would the drive vendors add support for a
crappier interface when DSM exists?

If you are set on using dd you could do zero detection in the kernel and
have the filesystem either send the data pages or issue discards for the
relevant regions if the device supports it. We pretty much have all the
infrastructure in place for that. But your time is better spent adding
FITRIM support to your filesystem of choice. XFS is done already,
Christoph posted the patches.


Phil> I don't think it would be that hard for the drive to recognize a
Phil> write of all zeroes. It already has to compute a set of Reed
Phil> Solomon parity symbols for every block written to the
Phil> drive.

That typically happens way later. There's usually a clear separation
between command processing and encoding. The zero detection needs to
happen early as it affects whether you need to mark the block in a
bitmap or allocate a real flash block.

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2011-01-07 16:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-07  3:22 TRIM details Phil Karn
2011-01-07  4:35 ` Martin K. Petersen
2011-01-07  9:11 ` Matthias Schniedermeyer
2011-01-07  9:17   ` Matthias Schniedermeyer
2011-01-07 14:15     ` Phil Karn
2011-01-07 14:13   ` Phil Karn
2011-01-07 16:50     ` Martin K. Petersen [this message]
2011-01-07 23:43       ` Phil Karn
2011-01-07 14:21   ` Phil Karn

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=yq1ei8oodz2.fsf@sermon.lab.mkp.net \
    --to=martin.petersen@oracle.com \
    --cc=karn@ka9q.net \
    --cc=xfs@oss.sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox