svn commit: r248573 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Steven Hartland smh at FreeBSD.org
Thu Mar 21 10:02:33 UTC 2013


Author: smh
Date: Thu Mar 21 10:02:32 2013
New Revision: 248573
URL: http://svnweb.freebsd.org/changeset/base/248573

Log:
  Don't register repair writes in the trim map.
  
  The trim map inflight writes tree assumes non-conflicting writes, i.e.
  that there will never be two simultaneous write I/Os to the same range
  on the same vdev. This seemed like a sane assumption; however, in
  actual testing, it appears that repair I/Os can very well conflict
  with "normal" writes.
  
  I'm not quite sure if these conflicting writes are supposed to happen
  or not, but in the mean time, let's ignore repair writes for now. This
  should be safe considering that, by definition, we never repair blocks
  that are freed.
  
  Reviewed by:	pjd (mentor)
  Approved by:	pjd (mentor)
  Obtained from:	Source: https://github.com/dechamps/zfs/commit/6a3cebaf7c5fcc92007280b5d403c15d0e61dfe3

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Thu Mar 21 09:34:41 2013	(r248572)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Thu Mar 21 10:02:32 2013	(r248573)
@@ -2558,7 +2558,13 @@ zio_vdev_io_start(zio_t *zio)
 		}
 	}
 
-	if (vd->vdev_ops->vdev_op_leaf && zio->io_type == ZIO_TYPE_WRITE) {
+	/*
+	 * Note that we ignore repair writes for TRIM because they can conflict
+	 * with normal writes. This isn't an issue because, by definition, we
+	 * only repair blocks that aren't freed.
+	 */
+	if (vd->vdev_ops->vdev_op_leaf && zio->io_type == ZIO_TYPE_WRITE &&
+	    !(zio->io_flags & ZIO_FLAG_IO_REPAIR)) {
 		if (!trim_map_write_start(zio))
 			return (ZIO_PIPELINE_STOP);
 	}
@@ -2580,13 +2586,12 @@ zio_vdev_io_done(zio_t *zio)
 	    zio->io_type == ZIO_TYPE_WRITE || zio->io_type == ZIO_TYPE_FREE);
 
 	if (vd != NULL && vd->vdev_ops->vdev_op_leaf &&
-	    zio->io_type == ZIO_TYPE_WRITE) {
-		trim_map_write_done(zio);
-	}
-
-	if (vd != NULL && vd->vdev_ops->vdev_op_leaf &&
 	    (zio->io_type == ZIO_TYPE_READ || zio->io_type == ZIO_TYPE_WRITE)) {
 
+		if (zio->io_type == ZIO_TYPE_WRITE &&
+		    !(zio->io_flags & ZIO_FLAG_IO_REPAIR))
+			trim_map_write_done(zio);
+
 		vdev_queue_io_done(zio);
 
 		if (zio->io_type == ZIO_TYPE_WRITE)


More information about the svn-src-all mailing list