Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Mar 2018 19:16:25 +0000 (UTC)
From:      Steven Hartland <smh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r331848 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201803311916.w2VJGPcA058663@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.



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