From owner-svn-src-all@freebsd.org Thu Apr 11 13:20:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 006BD1584AE5; Thu, 11 Apr 2019 13:20:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 964DB8E708; Thu, 11 Apr 2019 13:20:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E2F7AA1F; Thu, 11 Apr 2019 13:20:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x3BDKoqi082522; Thu, 11 Apr 2019 13:20:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3BDKn4G082515; Thu, 11 Apr 2019 13:20:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201904111320.x3BDKn4G082515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 11 Apr 2019 13:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r346130 - in stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 346130 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 964DB8E708 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2019 13:20:51 -0000 Author: mav Date: Thu Apr 11 13:20:48 2019 New Revision: 346130 URL: https://svnweb.freebsd.org/changeset/base/346130 Log: MFC r344936: MFV/ZoL: Disable LBA weighting on files and SSDs The LBA weighting makes sense on rotational media where the outer tracks have twice the bandwidth of the inner tracks. However, it is detrimental on nonrotational media such as solid state disks, where the only effect is to ensure that metaslabs enter the best-fit allocation behavior sooner, which is detrimental to performance. It also makes no sense on files where the underlying filesystem can arrange things however it wants. Author: Richard Yao Signed-off-by: Richard Yao Signed-off-by: Brian Behlendorf Closes #3712 zfsonlinux/zfs@fb40095f5f0853946f8150481ca22602d1334dfe To reduce code divergence this merge replaces equivalent but different FreeBSD code detecting non-rotating medium vdevs. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Thu Apr 11 13:19:46 2019 (r346129) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Thu Apr 11 13:20:48 2019 (r346130) @@ -1830,7 +1830,7 @@ metaslab_space_weight(metaslab_t *msp) * In effect, this means that we'll select the metaslab with the most * free bandwidth rather than simply the one with the most free space. */ - if (metaslab_lba_weighting_enabled) { + if (!vd->vdev_nonrot && metaslab_lba_weighting_enabled) { weight = 2 * weight - (msp->ms_id * weight) / vd->vdev_ms_count; ASSERT(weight >= space && weight <= 2 * space); } Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Thu Apr 11 13:19:46 2019 (r346129) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Thu Apr 11 13:20:48 2019 (r346130) @@ -235,6 +235,7 @@ struct vdev { vdev_stat_t vdev_stat; /* virtual device statistics */ boolean_t vdev_expanding; /* expand the vdev? */ boolean_t vdev_reopening; /* reopen in progress? */ + boolean_t vdev_nonrot; /* true if solid state */ int vdev_open_error; /* error on last open */ kthread_t *vdev_open_thread; /* thread opening children */ uint64_t vdev_crtxg; /* txg when top-level was added */ @@ -372,9 +373,6 @@ struct vdev { zio_t *vdev_probe_zio; /* root of current probe */ vdev_aux_t vdev_label_aux; /* on-disk aux state */ struct trim_map *vdev_trimmap; /* map on outstanding trims */ - uint16_t vdev_rotation_rate; /* rotational rate of the media */ -#define VDEV_RATE_UNKNOWN 0 -#define VDEV_RATE_NON_ROTATING 1 uint64_t vdev_leaf_zap; /* Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Apr 11 13:19:46 2019 (r346129) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Apr 11 13:20:48 2019 (r346130) @@ -1476,15 +1476,19 @@ vdev_open_children(vdev_t *vd) taskq_t *tq; int children = vd->vdev_children; + vd->vdev_nonrot = B_TRUE; + /* * in order to handle pools on top of zvols, do the opens * in a single thread so that the same thread holds the * spa_namespace_lock */ if (B_TRUE || vdev_uses_zvols(vd)) { - for (int c = 0; c < children; c++) + for (int c = 0; c < children; c++) { vd->vdev_child[c]->vdev_open_error = vdev_open(vd->vdev_child[c]); + vd->vdev_nonrot &= vd->vdev_child[c]->vdev_nonrot; + } return; } tq = taskq_create("vdev_open", children, minclsyspri, @@ -1495,6 +1499,9 @@ vdev_open_children(vdev_t *vd) TQ_SLEEP) != 0); taskq_destroy(tq); + + for (int c = 0; c < children; c++) + vd->vdev_nonrot &= vd->vdev_child[c]->vdev_nonrot; } /* Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Thu Apr 11 13:19:46 2019 (r346129) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Thu Apr 11 13:20:48 2019 (r346130) @@ -72,6 +72,9 @@ vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t * vattr_t vattr; int error; + /* Rotational optimizations only make sense on block devices */ + vd->vdev_nonrot = B_TRUE; + /* * We must have a pathname, and it must be absolute. */ Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Apr 11 13:19:46 2019 (r346129) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Apr 11 13:20:48 2019 (r346130) @@ -88,10 +88,10 @@ vdev_geom_set_rotation_rate(vdev_t *vd, struct g_consu uint16_t rate; error = g_getattr("GEOM::rotation_rate", cp, &rate); - if (error == 0) - vd->vdev_rotation_rate = rate; + if (error == 0 && rate == 1) + vd->vdev_nonrot = B_TRUE; else - vd->vdev_rotation_rate = VDEV_RATE_UNKNOWN; + vd->vdev_nonrot = B_FALSE; } static void Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Thu Apr 11 13:19:46 2019 (r346129) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Thu Apr 11 13:20:48 2019 (r346130) @@ -169,7 +169,7 @@ vdev_mirror_load(mirror_map_t *mm, vdev_t *vd, uint64_ load = vdev_queue_length(vd); lastoffset = vdev_queue_lastoffset(vd); - if (vd->vdev_rotation_rate == VDEV_RATE_NON_ROTATING) { + if (vd->vdev_nonrot) { /* Non-rotating media. */ if (lastoffset == zio_offset) return (load + non_rotating_inc); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Thu Apr 11 13:19:46 2019 (r346129) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Thu Apr 11 13:20:48 2019 (r346130) @@ -686,7 +686,7 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio) ASSERT(MUTEX_HELD(&vq->vq_lock)); maxblocksize = spa_maxblocksize(vq->vq_vdev->vdev_spa); - if (vq->vq_vdev->vdev_rotation_rate == VDEV_RATE_NON_ROTATING) + if (vq->vq_vdev->vdev_nonrot) limit = zfs_vdev_aggregation_limit_non_rotating; else limit = zfs_vdev_aggregation_limit;