linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gordan Bobic <gordan@bobich.net>
To: <linux-btrfs@vger.kernel.org>
Subject: Re: SSD Optimizations
Date: Thu, 11 Mar 2010 16:15:37 +0000	[thread overview]
Message-ID: <66212e5fade0ce6ec9086b8b71be36fe@localhost> (raw)
In-Reply-To: <4B98F350.6080804@shiftmail.org>

On Thu, 11 Mar 2010 14:42:40 +0100, Asdo <asdo@shiftmail.org> wrote:

> 1- I think the SSD would rewrite once-written blocks to other locations,

> so to reuse the same physical blocks for wear levelling. The 
> written-once blocks are very good candidates because their write-count 
> is "1"

There are likely to be millions of blocks with the same write count. How
do you pick the optimal ones?

> 2- I think SSDs show you a smaller usable size than what they physically

> have. In this way they always have some more blocks for moving data to, 
> so to free blocks which have a low write-count.

I'm pretty sure that is the case, too. However, to be able to deal with
the worst case scenario you would have to effectively double the amoutn of
flash (only expose half of it as addressable). With some corner cutting and
assumptions about file systems' block sizes (usually 4KB these days), you
can cut a corner, but that's dodgy until we get bigger hardware sectors as
standard.

> 3- If you think #2 is not enough you can leave part of the SSD disk 
> unused, by leaving unused space after the last partition.

That is true, but I'd rather apply some higher level logic to this rather
than expect the firmware do make a guess about things it has absolutely no
way of knowing for sure.

> Actually, after considering #1 and #2, I don't think TRIM is really 
> needed for SSDs, are you sure it is really needed?

I don't think there's any doubt that trim helps flash longevity.

> I think it's more a 
> kind of optimization, but it needs to be very fast for it to be useful 
> as an optimization, faster than an internal block rewrite by the SSD 
> wear levelling, and so fast as SATA/SAS command that the computer is not

> significantly slowed down by using it. Instead IIRC I read something 
> about it being slow and maybe was even requiring FUA or barrier or 
> flush? I don't remember exactly.

There is no obligation on part of the disk to do anything in response to
the trim command, IIRC. It is advisory. It doesn't have to clear the blocks
online. In fact, trim is sector based, and it is unlikely an SSD would act
until it can sensibly free an entire erase block.

> There is one place where TRIM would be very useful though, and it's not 
> for SSDs, but it's in virtualization: if the Virtual Machine frees 
> space, the VM file system should use TRIM to signal to the host that 
> some space is unused. The host should have a way to tell its filesystem 
> that the VM-disk-file has a new hole in that position, so that disk 
> space can be freed on the host for use for another VM. This would allow 
> much greater overcommit of disk spaces to virtual machines.

Indeed, I brought this very point up on the KVM mailing list a while back.

Gordan

  parent reply	other threads:[~2010-03-11 16:15 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 19:49 SSD Optimizations Gordan Bobic
2010-03-10 21:14 ` Marcus Fritzsch
2010-03-10 21:22   ` Marcus Fritzsch
2010-03-10 23:13   ` Gordan Bobic
2010-03-11 10:35     ` Daniel J Blueman
2010-03-11 12:03       ` Gordan Bobic
2010-03-10 23:12 ` Mike Fedyk
2010-03-10 23:22   ` Gordan Bobic
2010-03-11  7:38     ` Sander
2010-03-11 10:59       ` Hubert Kario
2010-03-11 11:31         ` Stephan von Krawczynski
2010-03-11 12:17           ` Gordan Bobic
2010-03-11 12:59             ` Stephan von Krawczynski
2010-03-11 13:20               ` Gordan Bobic
2010-03-11 14:01                 ` Hubert Kario
2010-03-11 15:35                   ` Stephan von Krawczynski
2010-03-11 16:03                     ` Gordan Bobic
2010-03-11 16:19                       ` Chris Mason
2010-03-12  1:07                         ` Hubert Kario
2010-03-12  1:42                           ` Chris Mason
2010-03-12  9:15                           ` Stephan von Krawczynski
2010-03-12 16:00                             ` Hubert Kario
2010-03-13 17:02                               ` Stephan von Krawczynski
2010-03-13 19:01                                 ` Hubert Kario
2010-03-11 16:48             ` Martin K. Petersen
2010-03-11 14:39           ` Sander
2010-03-11 17:35             ` Stephan von Krawczynski
2010-03-11 18:00               ` Chris Mason
2010-03-13 16:43                 ` Stephan von Krawczynski
2010-03-13 19:41                   ` Hubert Kario
2010-03-13 21:48                   ` Chris Mason
2010-03-14  3:19                   ` Jeremy Fitzhardinge
2010-03-11 12:09         ` Gordan Bobic
2010-03-11 16:22           ` Martin K. Petersen
2010-03-11 11:59       ` Gordan Bobic
2010-03-11 15:59         ` Asdo
     [not found]         ` <4B98F350.6080804@shiftmail.org>
2010-03-11 16:15           ` Gordan Bobic [this message]
2010-03-11 14:21 ` Chris Mason
2010-03-11 16:18   ` Gordan Bobic
2010-03-11 16:29     ` Chris Mason
  -- strict thread matches above, loose matches on Subject: below --
2010-12-12 17:24 SSD optimizations Paddy Steed
2010-12-13  0:04 ` Gordan Bobic
2010-12-13  5:11   ` Sander
2010-12-13  9:25     ` Gordan Bobic
2010-12-13 14:33       ` Peter Harris
2010-12-13 15:04         ` Gordan Bobic
2010-12-13 15:17       ` cwillu
2010-12-13 16:48         ` Gordan Bobic
2010-12-13 17:17   ` Paddy Steed
2010-12-13 17:47     ` Gordan Bobic
2010-12-13 18:20     ` Tomasz Torcz
2010-12-13 19:34       ` Ric Wheeler

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=66212e5fade0ce6ec9086b8b71be36fe@localhost \
    --to=gordan@bobich.net \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).