Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Aug 2013 14:30:28 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r253992 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys
Message-ID:  <201308061430.r76EUSNi030546@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Aug  6 14:30:28 2013
New Revision: 253992
URL: http://svnweb.freebsd.org/changeset/base/253992

Log:
  Disable r252840 when ZFS TRIM is enabled (vfs.zfs.trim.enabled=1) and really
  disable TRIM otherwise.
  
  r252840 (illumos bug 3836) is based on assumption that zio_free_sync() has
  no lock dependencies and should complete immediately. Unfortunately, with our
  TRIM implementation that is not true due to ZIO_STAGE_VDEV_IO_START added
  to the ZIO_FREE_PIPELINE, which, while not really accessing devices, still
  acquires SCL_ZIO lock for read to be sure devices won't disappear.
  
  When TRIM is disabled, this patch enables direct free execution from r252840
  and removes ZIO_STAGE_VDEV_IO_START and ZIO_STAGE_VDEV_IO_ASSESS stages from
  the pipeline to avoid lock acquisition.  Otherwise it queues free request as
  it was before r252840.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h	Tue Aug  6 14:23:33 2013	(r253991)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h	Tue Aug  6 14:30:28 2013	(r253992)
@@ -213,9 +213,7 @@ enum zio_stage {
 #define	ZIO_FREE_PIPELINE			\
 	(ZIO_INTERLOCK_STAGES |			\
 	ZIO_STAGE_FREE_BP_INIT |		\
-	ZIO_STAGE_DVA_FREE |			\
-	ZIO_STAGE_VDEV_IO_START |		\
-	ZIO_STAGE_VDEV_IO_ASSESS)
+	ZIO_STAGE_DVA_FREE)
 
 #define	ZIO_DDT_FREE_PIPELINE			\
 	(ZIO_INTERLOCK_STAGES |			\

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Tue Aug  6 14:23:33 2013	(r253991)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Tue Aug  6 14:30:28 2013	(r253992)
@@ -770,7 +770,7 @@ zio_free(spa_t *spa, uint64_t txg, const
 	 * DEDUP), can be processed immediately.  Otherwise, put them on the
 	 * in-memory list for later processing.
 	 */
-	if (BP_IS_GANG(bp) || BP_GET_DEDUP(bp) ||
+	if (zfs_trim_enabled || BP_IS_GANG(bp) || BP_GET_DEDUP(bp) ||
 	    txg != spa->spa_syncing_txg ||
 	    spa_sync_pass(spa) >= zfs_sync_pass_deferred_free) {
 		bplist_append(&spa->spa_free_bplist[txg & TXG_MASK], bp);
@@ -797,12 +797,15 @@ zio_free_sync(zio_t *pio, spa_t *spa, ui
 	metaslab_check_free(spa, bp);
 	arc_freed(spa, bp);
 
+	if (zfs_trim_enabled)
+		stage |= ZIO_STAGE_ISSUE_ASYNC | ZIO_STAGE_VDEV_IO_START |
+		    ZIO_STAGE_VDEV_IO_ASSESS;
 	/*
 	 * GANG and DEDUP blocks can induce a read (for the gang block header,
 	 * or the DDT), so issue them asynchronously so that this thread is
 	 * not tied up.
 	 */
-	if (BP_IS_GANG(bp) || BP_GET_DEDUP(bp))
+	else if (BP_IS_GANG(bp) || BP_GET_DEDUP(bp))
 		stage |= ZIO_STAGE_ISSUE_ASYNC;
 
 	zio = zio_create(pio, spa, txg, bp, NULL, size,



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