Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Dec 2010 21:45:46 -0800
From:      Kirk McKusick <mckusick@mckusick.com>
To:        Julian Elischer <julian@freebsd.org>
Cc:        Oliver Fromme <olli@lurza.secnetix.de>, Pawel Jakub Dawidek <pjd@freebsd.org>, freebsd-fs@freebsd.org
Subject:   Re: TRIM support for UFS? 
Message-ID:  <201012100545.oBA5jkwO027291@chez.mckusick.com>
In-Reply-To: <4D01B878.4020008@freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Date: Thu, 09 Dec 2010 21:19:52 -0800
> From: Julian Elischer <julian@freebsd.org>
> To: Pawel Jakub Dawidek <pjd@freebsd.org>
> CC: Bakul Shah <bakul@bitblocks.com>, Kirk McKusick <mckusick@mckusick.com>,
>         Oliver Fromme <olli@lurza.secnetix.de>, freebsd-fs@freebsd.org
> Subject: Re: TRIM support for UFS?
> 
> One of the things that has not been mentioned is that releasing
> space in a file is not really 'free' (at least not for us) if you
> want things to remain trimmed after a reboot.  So if I were
> implementing it I'd want a couple of parameters.
> 
> 1/ don't bother trimming free space under some size.
>
> 2/ does it matter if the trimmed space comes back as garbage
> after an unclean shutdown? (a hint to the driver, and no, I don't
> know anyone that supports this yet)
> (there are security implications to that one but cheap trim (that
> may come back) is way cheaper than persistent trim to impliment).
> 
> With these parameters we (fusion-io) could tune our behaviour
> which can save performance, and also the file system could tune
> it's min-trim value to see what gives best performance.

The above is one of the reasons that we never implemented the
`release' system call. To be stable after a crash requires either
a lot of synchronous writes or a bunch more soft update dependencies.
Many of the same issues relate to stability of snapshots across
system crashes. In the end we added the dopersistence flag:

/*
 * To ensure the consistency of snapshots across crashes, we must
 * synchronously write out copied blocks before allowing the
 * originals to be modified. Because of the rather severe speed
 * penalty that this imposes, the following flag allows this
 * crash persistence to be disabled.
 */
int dopersistence = 0;
         
#ifdef DEBUG
#include <sys/sysctl.h>
SYSCTL_INT(_debug, OID_AUTO, dopersistence, CTLFLAG_RW, &dopersistence, 0, "");
#endif /* DEBUG */

As you can see it defaults to off.

	Kirk McKusick



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012100545.oBA5jkwO027291>