6625167 gang blocks don't need to retry so hard
authorgw25295
Fri, 02 Nov 2007 16:28:04 -0700
changeset 5403 0bfd0977c989
parent 5402 a17d5e4e8666
child 5404 44f7170950b8
6625167 gang blocks don't need to retry so hard
usr/src/uts/common/fs/zfs/sys/zio.h
usr/src/uts/common/fs/zfs/zio.c
--- a/usr/src/uts/common/fs/zfs/sys/zio.h	Fri Nov 02 15:39:34 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/sys/zio.h	Fri Nov 02 16:28:04 2007 -0700
@@ -146,7 +146,6 @@
 
 #define	ZIO_FLAG_NOBOOKMARK		0x10000
 #define	ZIO_FLAG_USER			0x20000
-
 #define	ZIO_FLAG_METADATA		0x40000
 #define	ZIO_FLAG_WRITE_RETRY		0x80000
 
@@ -159,7 +158,9 @@
 	ZIO_FLAG_SPECULATIVE |		\
 	ZIO_FLAG_RESILVER |		\
 	ZIO_FLAG_SCRUB |		\
-	ZIO_FLAG_SCRUB_THREAD)
+	ZIO_FLAG_SCRUB_THREAD |		\
+	ZIO_FLAG_USER | 		\
+	ZIO_FLAG_METADATA)
 
 #define	ZIO_FLAG_VDEV_INHERIT		\
 	(ZIO_FLAG_GANG_INHERIT |	\
--- a/usr/src/uts/common/fs/zfs/zio.c	Fri Nov 02 15:39:34 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/zio.c	Fri Nov 02 16:28:04 2007 -0700
@@ -124,12 +124,6 @@
 	((zio)->io_orig_pipeline == ZIO_WRITE_PIPELINE ||		\
 	(zio)->io_pipeline & (1U << ZIO_STAGE_DVA_ALLOCATE))
 
-/*
- * The only way to tell is by looking for the gang pipeline stage
- */
-#define	IO_IS_REWRITE(zio)						\
-	((zio)->io_pipeline & (1U << ZIO_STAGE_GANG_PIPELINE))
-
 void
 zio_init(void)
 {
@@ -948,12 +942,9 @@
 
 	/*
 	 * We must zero out the old DVA and blk_birth before reallocating
-	 * the bp. We don't want to do this if this is a rewrite however.
+	 * the bp.
 	 */
-	if (!IO_IS_REWRITE(zio)) {
-		BP_ZERO_DVAS(zio->io_bp);
-	}
-
+	BP_ZERO_DVAS(zio->io_bp);
 	zio_reset(zio);
 
 	if (pio) {
@@ -1137,14 +1128,13 @@
 		}
 
 		/*
-		 * If we are an allocating I/O or have been told to retry
-		 * then attempt to reissue the I/O on another vdev unless
-		 * the pool is out of space.  We handle this condition
-		 * based on the spa's failmode property.
+		 * If we are an allocating I/O then we attempt to reissue
+		 * the I/O on another vdev unless the pool is out of space.
+		 * We handle this condition based on the spa's failmode
+		 * property.
 		 */
 		if (zio_write_retry && zio->io_error != ENOSPC &&
-		    (IO_IS_ALLOCATING(zio) ||
-		    zio->io_flags & ZIO_FLAG_WRITE_RETRY)) {
+		    IO_IS_ALLOCATING(zio)) {
 			zio_vdev_retry_io(zio);
 			return;
 		}
@@ -1600,7 +1590,8 @@
 			    zio->io_checksum, txg, gbp,
 			    (char *)zio->io_data + loff, lsize,
 			    zio_write_allocate_gang_member_done, NULL,
-			    zio->io_priority, zio->io_flags,
+			    zio->io_priority,
+			    zio->io_flags & ZIO_FLAG_GANG_INHERIT,
 			    &zio->io_bookmark));
 		} else {
 			lsize = P2ROUNDUP(resid / gbps_left, SPA_MINBLOCKSIZE);
@@ -1609,7 +1600,8 @@
 			    zio->io_checksum, txg, gbp,
 			    (char *)zio->io_data + loff, lsize,
 			    zio_write_allocate_gang_member_done, NULL,
-			    zio->io_priority, zio->io_flags));
+			    zio->io_priority,
+			    zio->io_flags & ZIO_FLAG_GANG_INHERIT));
 		}
 	}
 
@@ -1657,8 +1649,7 @@
 	/*
 	 * For testing purposes, we force I/Os to retry. We don't allow
 	 * retries beyond the first pass since those I/Os are non-allocating
-	 * writes. We do this after the gang block testing block so that
-	 * they don't inherit the retry flag.
+	 * writes.
 	 */
 	if (zio_io_fail_shift &&
 	    spa_sync_pass(zio->io_spa) <= zio_sync_pass.zp_rewrite &&