On Mon, Nov 7, 2011 at 11:21 AM, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
> On Sat, Nov 05, 2011 at 09:07:05PM +0100, Martin Rusko wrote:
>> SSD drive in question is one of the latest with SF-2281 chipset. I
>> expected, that TRIM function will just schedule sectors for garbage
>> collection, which happens some time later (during which drive can be
>> potentially slower). Trying the same tests with ext4 filesystem, it
>> got following numbers.
> That's unfortunately not how it works - the TRIM command always drains
> the whole queue of outstanding requests, and thus has a fairly severe
> impact on performance. We could reduce it a bit by using vectored
> trims like Windows does, but the Linux blocklayer doesn't have the
> infrastructure for that yet.
> Your workload will remove a lot of inode clusters on XFS, while ext4
> never deletes inodes. Using the ikeep mount option for XFS (can't be
> set during remount) should speed the performance with discard for
> your workload up a lot. I would still recommand to do a periodic
> fstrim run instead, though.
As per man page ...
When inode clusters are emptied of inodes, keep them around on
the disk (ikeep) - this is the traditional XFS behaviour and is still
default for now. Using the noikeep option, inode clusters are
returned to the free space pool.
... which would imply, that it should be actually rather fast by
default. Even if I had set this explicitly, it didn't really help ...
# mount -o noatime,discard,ikeep /dev/data/test-xfs /mnt/disk
/dev/mapper/data-test--xfs on /mnt/disk type xfs (rw,noatime,discard,ikeep)
# time rm -rf linux-3.0.8
... normally it would be deleted in a second or even faster.
I'm fine to use periodic fstrim, let say once a day. But this is such
a big difference, that it makes me curious if it is expected behavior
or if I'm doing something terribly wrong. Any idea? Thanks!