svn commit: r331848 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Steven Hartland smh at FreeBSD.org
Sat Mar 31 19:16:26 UTC 2018


Author: smh
Date: Sat Mar 31 19:16:25 2018
New Revision: 331848
URL: https://svnweb.freebsd.org/changeset/base/331848

Log:
  MFC r330950:
  
  Prevent ZFS TRIM breaking VTOC8 partitions
  
  Sponsored by:	Multiplay

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
==============================================================================
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c	Sat Mar 31 17:28:30 2018	(r331847)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c	Sat Mar 31 19:16:25 2018	(r331848)
@@ -728,7 +728,9 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_label
 	}
 
 	/*
-	 * TRIM the whole thing so that we start with a clean slate.
+	 * TRIM the whole thing, excluding the blank space and boot header
+	 * as specified by ZFS On-Disk Specification (section 1.3), so that
+	 * we start with a clean slate.
 	 * It's just an optimization, so we don't care if it fails.
 	 * Don't TRIM if removing so that we don't interfere with zpool
 	 * disaster recovery.
@@ -736,7 +738,8 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_label
 	if (zfs_trim_enabled && vdev_trim_on_init && !vd->vdev_notrim && 
 	    (reason == VDEV_LABEL_CREATE || reason == VDEV_LABEL_SPARE ||
 	    reason == VDEV_LABEL_L2CACHE))
-		zio_wait(zio_trim(NULL, spa, vd, 0, vd->vdev_psize));
+		zio_wait(zio_trim(NULL, spa, vd, VDEV_SKIP_SIZE,
+		    vd->vdev_psize - VDEV_SKIP_SIZE));
 
 	/*
 	 * Initialize its label.


More information about the svn-src-all mailing list