From nobody Mon May 01 21:04:14 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q9G0t6d2Gz491J9; Mon, 1 May 2023 21:04:14 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q9G0t686dz3HrS; Mon, 1 May 2023 21:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682975054; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AELX0kqbNaAkvNEtris2lMCW8x7iyCp1ByGF1B656MY=; b=mRZP04XbRulFcjGG2RG7Y+7gquPIjWKQgqotxlh99muoAJaeeNpwSdil1e3FIbhczwb8Q4 zetth19QWOrQOV/MWyjCoiVJPgDRvR/T07TQqdra95WdBi6MjggSLq3fHzqRV1F9SuW6in kwiTjMCdCk1xwnGIambERaE11dOkADZlrK5xnL0Tweaviq0fNHA/lDpIMWQGFwbpmdAFrQ BY/tafcm+8x1xMTtXP6jXBLGBM9N79zl/D1KhtwPIqZoiPSeHqqQgRdfhWpRDdvZHhk6/B VwTJPsfN+PA+xYXhSB4pMG8GRpXej+UjCO5/RdlhMkH27nT9ljmv4AMtnfX5AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682975054; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AELX0kqbNaAkvNEtris2lMCW8x7iyCp1ByGF1B656MY=; b=I4BuZ6iKmAiBKwWFBBRjRu/lHdsnTHndadruTd3stbI/Ewgl4v/3hogAQCqrYBLInFj36x Xa4Kk8Hy56YejNQzkacTJvzxH+WHyzJfmVQyMvTxuN2RHslDCvvU6peTRDmyJNnLVfLpy4 kb8DXu7e/NJo7RdkVf884xMeDdLvl82QMQeDVAHIld0kRjdXWZRaYFIqZz4joTLJWj+iOg 5bI7Dn7q0fcLEL38RRKAEhiHNuAJSHWudvHygbSR/9IUwr7Trz012gprs9r1503jMzWyGx 3yqjePKCs5pnPn0EJf48iLyZR4ltj4AAHlon50r+FBX57RaKEA1azStg159xOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682975054; a=rsa-sha256; cv=none; b=TVOfRCoY/zSukK84a3P2ctRwwVlXUCuJenBvRvPqHSkUc3IqkUeI1X9igHjTnWmjZvy7gL OAQEOjuwYnf+S9Etp06cEvpvNLRBZ2BRy0TP7umRE1h4tfaoB+WsiT/zvakW/puigT+Dml 2GZkNEBazmn9eyfYPaVR/2m7zi+72yK7IvUnrfX/suZV2hlfAC25k/xDflNo082CYU4vZa 3u3MF3//5VPt+vc5NlXtFXtmdG7jcwHMkQygltmmKqVgAv0B1e2GVoB8rI1wmKvXsHR8sZ 1aU8P6ez4EumzNN0T0BIQjoE3CweOyxgGbHjGKq43Mx344BCZsGOrQ2GlB0bIQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Q9G0t53v4zLZk; Mon, 1 May 2023 21:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 341L4EWa051780; Mon, 1 May 2023 21:04:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 341L4EB0051779; Mon, 1 May 2023 21:04:14 GMT (envelope-from git) Date: Mon, 1 May 2023 21:04:14 GMT Message-Id: <202305012104.341L4EB0051779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 4dcae288fe63 - main - stand/zfs: Refactor zfs_set_bootenv List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4dcae288fe63667bdf930258b94e0e51a2d05787 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4dcae288fe63667bdf930258b94e0e51a2d05787 commit 4dcae288fe63667bdf930258b94e0e51a2d05787 Author: Warner Losh AuthorDate: 2023-05-01 15:26:59 +0000 Commit: Warner Losh CommitDate: 2023-05-01 21:02:53 +0000 stand/zfs: Refactor zfs_set_bootenv Refactor zfs_set_bootenv to split out the lookup of spa from the rest. zfs_set_bootenv_spa flushes the benv to the vdevs and updates the cached benv. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D39410 --- stand/libsa/zfs/zfs.c | 14 ++------------ stand/libsa/zfs/zfsimpl.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/stand/libsa/zfs/zfs.c b/stand/libsa/zfs/zfs.c index 17f213fe833c..7cdfa1a06df9 100644 --- a/stand/libsa/zfs/zfs.c +++ b/stand/libsa/zfs/zfs.c @@ -812,22 +812,12 @@ zfs_get_bootenv(void *vdev, nvlist_t **benvp) int zfs_set_bootenv(void *vdev, nvlist_t *benv) { - struct zfs_devdesc *dev = (struct zfs_devdesc *)vdev; spa_t *spa; - vdev_t *vd; - if (dev->dd.d_dev->dv_type != DEVT_ZFS) - return (ENOTSUP); - - if ((spa = spa_find_by_dev(dev)) == NULL) + if ((spa = spa_find_by_dev((struct zfs_devdesc *)vdev)) == NULL) return (ENXIO); - STAILQ_FOREACH(vd, &spa->spa_root_vdev->v_children, v_childlink) { - vdev_write_bootenv(vd, benv); - } - - spa->spa_bootenv = benv; - return (0); + return (zfs_set_bootenv_spa(spa, benv)); } /* diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c index 40a1448a0c9f..3b093dea3c41 100644 --- a/stand/libsa/zfs/zfsimpl.c +++ b/stand/libsa/zfs/zfsimpl.c @@ -3883,3 +3883,19 @@ zfs_get_bootenv_spa(spa_t *spa, nvlist_t **benvp) *benvp = benv; return (0); } + +/* + * Store nvlist to pool label bootenv area. Also updates cached pointer in spa. + */ +static int +zfs_set_bootenv_spa(spa_t *spa, nvlist_t *benv) +{ + vdev_t *vd; + + STAILQ_FOREACH(vd, &spa->spa_root_vdev->v_children, v_childlink) { + vdev_write_bootenv(vd, benv); + } + + spa->spa_bootenv = benv; + return (0); +}