Changed ZFS TRIM sysctl from vfs.zfs.trim_disable -> vfs.zfs.trim.enabled

Enabled ZFS TRIM by default

Reviewed by:	pjd (mentor)
Approved by:	pjd (mentor)
MFC after:	2 weeks
This commit is contained in:
Steven Hartland 2013-04-26 11:24:20 +00:00
parent 8e015fd886
commit 562a9d583b
5 changed files with 21 additions and 15 deletions

View File

@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20130426:
The sysctl which controls TRIM support under ZFS has been renamed
from vfs.zfs.trim_disable -> vfs.zfs.trim.enabled and has been
enabled by default.
20130425:
The mergemaster command now uses the default MAKEOBJDIRPREFIX
rather than creating it's own in the temporary directory in

View File

@ -46,7 +46,7 @@ typedef enum vdev_dtl_type {
} vdev_dtl_type_t;
extern boolean_t zfs_nocacheflush;
extern boolean_t zfs_notrim;
extern boolean_t zfs_trim_enabled;
extern int vdev_open(vdev_t *);
extern void vdev_open_children(vdev_t *);

View File

@ -72,7 +72,7 @@ typedef struct trim_seg {
hrtime_t ts_time; /* Segment creation time. */
} trim_seg_t;
extern boolean_t zfs_notrim;
extern boolean_t zfs_trim_enabled;
static u_int trim_txg_delay = 32;
static u_int trim_timeout = 30;
@ -157,7 +157,7 @@ trim_map_create(vdev_t *vd)
ASSERT(vd->vdev_ops->vdev_op_leaf);
if (zfs_notrim)
if (!zfs_trim_enabled)
return;
tm = kmem_zalloc(sizeof (*tm), KM_SLEEP);
@ -183,7 +183,7 @@ trim_map_destroy(vdev_t *vd)
ASSERT(vd->vdev_ops->vdev_op_leaf);
if (zfs_notrim)
if (!zfs_trim_enabled)
return;
tm = vd->vdev_trimmap;
@ -340,7 +340,7 @@ trim_map_free(vdev_t *vd, uint64_t offset, uint64_t size, uint64_t txg)
{
trim_map_t *tm = vd->vdev_trimmap;
if (zfs_notrim || vd->vdev_notrim || tm == NULL)
if (!zfs_trim_enabled || vd->vdev_notrim || tm == NULL)
return;
mutex_enter(&tm->tm_lock);
@ -357,7 +357,7 @@ trim_map_write_start(zio_t *zio)
boolean_t left_over, right_over;
uint64_t start, end;
if (zfs_notrim || vd->vdev_notrim || tm == NULL)
if (!zfs_trim_enabled || vd->vdev_notrim || tm == NULL)
return (B_TRUE);
start = zio->io_offset;
@ -404,7 +404,7 @@ trim_map_write_done(zio_t *zio)
* Don't check for vdev_notrim, since the write could have
* started before vdev_notrim was set.
*/
if (zfs_notrim || tm == NULL)
if (!zfs_trim_enabled || tm == NULL)
return;
mutex_enter(&tm->tm_lock);
@ -589,7 +589,7 @@ void
trim_thread_create(spa_t *spa)
{
if (zfs_notrim)
if (!zfs_trim_enabled)
return;
mutex_init(&spa->spa_trim_lock, NULL, MUTEX_DEFAULT, NULL);
@ -604,7 +604,7 @@ void
trim_thread_destroy(spa_t *spa)
{
if (zfs_notrim)
if (!zfs_trim_enabled)
return;
if (spa->spa_trim_thread == NULL)
return;
@ -627,7 +627,7 @@ void
trim_thread_wakeup(spa_t *spa)
{
if (zfs_notrim)
if (!zfs_trim_enabled)
return;
if (spa->spa_trim_thread == NULL)
return;

View File

@ -729,7 +729,7 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason)
* Don't TRIM if removing so that we don't interfere with zpool
* disaster recovery.
*/
if (!zfs_notrim && vdev_trim_on_init && (reason == VDEV_LABEL_CREATE ||
if (zfs_trim_enabled && vdev_trim_on_init && (reason == VDEV_LABEL_CREATE ||
reason == VDEV_LABEL_SPARE || reason == VDEV_LABEL_L2CACHE))
zio_wait(zio_trim(NULL, spa, vd, 0, vd->vdev_psize));

View File

@ -83,10 +83,11 @@ boolean_t zfs_nocacheflush = B_FALSE;
TUNABLE_INT("vfs.zfs.cache_flush_disable", &zfs_nocacheflush);
SYSCTL_INT(_vfs_zfs, OID_AUTO, cache_flush_disable, CTLFLAG_RDTUN,
&zfs_nocacheflush, 0, "Disable cache flush");
boolean_t zfs_notrim = B_TRUE;
TUNABLE_INT("vfs.zfs.trim_disable", &zfs_notrim);
SYSCTL_INT(_vfs_zfs, OID_AUTO, trim_disable, CTLFLAG_RDTUN, &zfs_notrim, 0,
"Disable trim");
boolean_t zfs_trim_enabled = B_TRUE;
SYSCTL_DECL(_vfs_zfs_trim);
TUNABLE_INT("vfs.zfs.trim.enabled", &zfs_trim_enabled);
SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enabled, CTLFLAG_RDTUN, &zfs_trim_enabled, 0,
"Enable ZFS TRIM");
static kmem_cache_t *zil_lwb_cache;