linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: DarkNovaNick@gmail.com
To: Zdenek Kabelac <zdenek.kabelac@gmail.com>, DarkNovaNick@gmail.com
Cc: Mike Snitzer <snitzer@redhat.com>,
	LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] Testing TRIM with LVM
Date: Wed, 13 Apr 2011 15:38:20 +0000	[thread overview]
Message-ID: <bcaec51d23ca2a6bab04a0ce99d8@google.com> (raw)
In-Reply-To: <4DA561C3.9070808@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 4741 bytes --]

On Apr 13, 2011 3:41am, Zdenek Kabelac <zdenek.kabelac@gmail.com> wrote:
> Dne 13.4.2011 03:47, DarkNovaNick@gmail.com napsal(a):

> > On Apr 12, 2011 6:47pm, Mike Snitzer snitzer@redhat.com> wrote:

> >> On Tue, Apr 12 2011 at 10:59am -0400,

> >

> >> DarkNovaNick@gmail.com DarkNovaNick@gmail.com> wrote:

> >

> >

> >

> >> > I recently purchased a Crucial C300 SSD and set it up as my primary

> >

> >> > drive. I wanted to use LVM, and my reading indicates that LVM added

> >

> >> > support to pass-through TRIM commands with kernel 2.6.37. I'm

> >

> >> > running Ubuntu 10.10, but I installed the latest 11.04 kernel, so

> >

> >> > I'm running kernel 2.6.38-8. I added "discard" to fstab so my

> >

> >> > mountpoint looks like:

> >

> >> >

> >

> >> > /dev/mapper/vg0-vol0 on / type ext4

> >

> >> > (rw,noatime,nodiratime,errors=remount-ro,discard,commit=0)

> >

> >

> >

> >> If the discards aren't working then ext4 will print a warning and stop

> >

> >> issuing them, see: http://git.kernel.org/linus/a30eec2a8650a77f7

> >

> >

> >

> >> So if you don't see "discard not supported, disabling" in your dmesg  
> (or

> >

> >> /var/log/messages) then TRIM is likely working as expected.

> >

> >

> >

> >> > I found directions on various sites like:

> >

> >> >

> >>  
> http://duopetalflower.blogspot.com/2010/11/enterprise-kernel-6-has-ssd-trim.html

> >>

> >

> >> > on how to confirm if TRIM is working. I ran (as root):

> >

> >> >

> >

> >> > dd if=/dev/urandom of=tempfile count=100 bs=512k oflag=direct

> >

> >> > hdparm --fibmap tempfile

> >

> >> > (then took the first begin_LBA)

> >

> >> > hdparm --read-sector 191710208 /dev/sda

> >

> >> >

> >

> >> > and it printed:

> >

> >> >

> >

> >> > /dev/sda:

> >

> >> > reading sector 191710208: succeeded

> >

> >> > 3254 3a32 3834 313a 2b36 3030 303a 2030

> >

> >> > 4544 5542 2047 3728 3a29 5320 7661 6e69

> >

> >> > 2067 6e69 6564 2078 6f66 2072 7270 646f

> >

> >> > ............

> >

> >> >

> >

> >> > Then I ran:

> >

> >> > rm tempfile

> >

> >> > sync

> >

> >> > hdparm --read-sector 191710208 /dev/sda

> >

> >> >

> >

> >> > and it still returned:

> >

> >> > /dev/sda:

> >

> >> > reading sector 191710208: succeeded

> >

> >> > 3254 3a32 3834 313a 2b36 3030 303a 2030

> >

> >> > 4544 5542 2047 3728 3a29 5320 7661 6e69

> >

> >> > 2067 6e69 6564 2078 6f66 2072 7270 646f

> >

> >> > .............

> >

> >> >

> >

> >> > If TRIM is working, the sector is supposed to contain all zeros.

> >

> >

> >

> >> That is only if the SSD implements TRIM so that it zeroes the discarded

> >

> >> blocks. You can check if the device at least knows enough to report

> >

> >> discard_zeroes_data:

> >

> >

> >

> >> cat /sys/block/sda/queue/discard_zeroes_data

> >

> >

> >

> >> Also, even if the SSD does zero, it may take some time -- well after  
> the

> >

> >> discard has completed -- for the SSD to actually zero the blocks (this

> >

> >> is true of some lesser quality SSDs).

> >

> >

> >

> >> > Am I doing something wrong or do I need to do something more to get

> >

> >> > LVM to pass down the TRIM command?

> >

> >

> >

> >> LVM (device mapper specifically) passes discards perfectly well. But

> >

> >> the snapshot and dm-crypt targets don't have discard support. All other

> >

> >> targets do have discard support. What is your output for: dmsetup table

> >

> >

> >

> >> Mike

> >

> >

> >

> >

> > I get 0 back when I do "cat /sys/block/sda/queue/discard_zeroes_data"  
> so does

> > this mean that my drive doesn't zero out the TRIMed blocks? I don't  
> really

> > care if it does or does not, I just want to make sure the drive is  
> getting the

> > TRIM commands as the benchmarks I've seen show performance degradation  
> if they

> > aren't used.



> As I've the same drive - what kind of performance degradation do you see?



> Note: this drive (unlike many others) is processing TRIM command on

> background. So 'traditional' benchmark do not provide valuable results.

> (As we've been evaluating this drive somewhat to compare with Intel).



> Outcome is - when you issue TRIM command - it's immediately finished -  
> but the

> performance of drive is temporarily decreased while the drive is  
> performing

> block trimming for some time. Thus you might get 'impressive' results when

> some benchmarks are evaluating TRIM performance ;)



> Zdenek



I may not have been clear, but the benchmarks I am referring to show the  
performance degradation if you are *not* using TRIM (ie just relying on the  
drive's internal garbage collector). Which is why I want to make sure the  
TRIM is working so it doesn't get into this poor state.

Nick

[-- Attachment #2: Type: text/html, Size: 8591 bytes --]

  reply	other threads:[~2011-04-13 15:38 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12 14:59 [linux-lvm] Testing TRIM with LVM DarkNovaNick
2011-04-12 23:47 ` Mike Snitzer
2011-04-13  1:47   ` DarkNovaNick
2011-04-13  8:41     ` Zdenek Kabelac
2011-04-13 15:38       ` DarkNovaNick [this message]
2011-04-13 22:40     ` [linux-lvm] [PATCH] dm snapshot: add discard support to the snapshot-origin target [was: Re: Testing TRIM with LVM] Mike Snitzer
2011-04-13 23:48       ` [linux-lvm] " Mike Snitzer
2011-04-26 17:32         ` Mike Snitzer
2011-04-28  0:19           ` [linux-lvm] [PATCH] dm snapshot: ignore discards issued to the snapshot-origin target Mike Snitzer
2011-04-28  7:53             ` [linux-lvm] [dm-devel] " Christoph Hellwig
2011-04-28 20:59               ` [linux-lvm] do not disable ext4 discards on first discard failure? [was: Re: dm snapshot: ignore discards issued to the snapshot-origin target] Mike Snitzer
2011-04-28 21:28                 ` Eric Sandeen
2011-04-28 22:59                   ` Alasdair G Kergon
2011-04-28 23:01                     ` Eric Sandeen
2011-04-28 23:11                       ` Alasdair G Kergon
2011-04-29  1:12                 ` Andreas Dilger
2011-04-29 13:55                   ` Mike Snitzer
2011-04-29  9:30                 ` Lukas Czerner
2011-04-29 12:24                   ` [linux-lvm] [dm-devel] " Alasdair G Kergon
2011-04-29 12:29                     ` Christoph Hellwig
2011-04-29 14:28                       ` Eric Sandeen
2011-04-29 15:13                         ` Ray Morris
2011-05-04 16:33                         ` Ted Ts'o
2011-05-04 17:02                           ` Lukas Czerner
2011-05-02  7:16                     ` Lukas Czerner
2011-05-02  8:13                       ` Alasdair G Kergon
2011-05-02  8:19                         ` Christoph Hellwig
2011-05-02 10:24                           ` Lukas Czerner
2011-05-02 12:48                             ` [linux-lvm] " Mike Snitzer
2011-05-02 13:05                               ` Lukas Czerner
2011-05-02 14:47                                 ` Eric Sandeen
2011-05-02 14:48                                   ` Christoph Hellwig
2011-05-02 14:58                                   ` Lukas Czerner
2011-05-02 13:48                             ` [linux-lvm] [dm-devel] " Martin K. Petersen
2011-05-02 14:20                             ` Martin K. Petersen
2011-05-02 14:39                               ` Lukas Czerner
2011-05-02 14:50                                 ` Martin K. Petersen
2011-05-02 14:58                                 ` [linux-lvm] " Mike Snitzer
2011-05-02 16:58                                 ` [linux-lvm] [dm-devel] " Martin K. Petersen
2011-05-03  8:57                                   ` Lukas Czerner
2011-05-04 15:10                                     ` Martin K. Petersen
2011-05-04 16:02                                       ` [linux-lvm] " Mike Snitzer
2011-05-04 16:50                                         ` Martin K. Petersen
2011-05-04 18:03                                           ` Mike Snitzer
2011-05-04 17:10                                       ` [linux-lvm] [dm-devel] " Lukas Czerner
2011-05-04 17:32                                         ` Martin K. Petersen
2011-05-04 17:35                                           ` Lukas Czerner
2011-05-18 12:16                                       ` [linux-lvm] " Mike Snitzer
2011-05-18 12:52                                         ` Mike Snitzer
2011-05-04 15:16                                     ` [linux-lvm] [dm-devel] " Martin K. Petersen
2011-05-04 16:12                                       ` Lukas Czerner
2011-05-05  8:33                                       ` Karel Zak
2011-05-05 10:48                                         ` Lukas Czerner
2011-04-14 15:31       ` [linux-lvm] [PATCH] dm snapshot: add discard support to the snapshot-origin target [was: Re: Testing TRIM wi DarkNovaNick

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=bcaec51d23ca2a6bab04a0ce99d8@google.com \
    --to=darknovanick@gmail.com \
    --cc=linux-lvm@redhat.com \
    --cc=snitzer@redhat.com \
    --cc=zdenek.kabelac@gmail.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;
as well as URLs for NNTP newsgroup(s).