[Top] [All Lists]

Re: [xfs-masters] how to use fstrim?

To: Greg Freemyer <greg.freemyer@xxxxxxxxx>
Subject: Re: [xfs-masters] how to use fstrim?
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 1 Aug 2013 10:08:45 +1000
Cc: Stefan Priebe <s.priebe@xxxxxxxxxxxx>, "xfs-masters@xxxxxxxxxxx" <xfs-masters@xxxxxxxxxxx>, "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <CAGpXXZ+no_YcepmwMopFDYO_6PR6jOop9UpY_mAcaPbLA6CYkg@xxxxxxxxxxxxxx>
References: <51F2BD31.5060301@xxxxxxxxxxxx> <20130727015029.GT13468@dastard> <CAGpXXZ+no_YcepmwMopFDYO_6PR6jOop9UpY_mAcaPbLA6CYkg@xxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Wed, Jul 31, 2013 at 09:26:35AM -0400, Greg Freemyer wrote:
> On Fri, Jul 26, 2013 at 9:50 PM, Dave Chinner <david@xxxxxxxxxxxxx> wrote:
> > IOWs, the behaviour of fstrim on XFS is entirely dependent on the
> > speed of the block layer and hardware implementations of discards.
> And on a lot of SSDs, trim seems to act like a cache flush so it can
> hit performance hard.

That's because TRIM on SATA3 is an unqueued command. It basically
causes the pipeline to be emptied before it can be issued, and no
further IO can be issued until it completes. SATA3.1 is supposed to
add a queued TRIM command, but it might be some time before we see
that appearing in hardware...

> It should be scheduled for off-peak times
> afaik.  It's not critical to run hourly or even daily.  If you can
> schedule it once a week when other i/o is light that should be enough
> for most workloads.

I run it once every couple of months on my SSDs, if ever. Most
modern SSDs have background defragmentation so if they are left idle
for a couple of hours they clean themselves up pretty well without
needing TRIM...


Dave Chinner

<Prev in Thread] Current Thread [Next in Thread>