From nobody Wed Oct 25 16:56:45 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 4SFw7f247rz4xlCJ; Wed, 25 Oct 2023 16:56:46 +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 4SFw7f1QCLz4cC4; Wed, 25 Oct 2023 16:56:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698253006; 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=bplNSAUK7iId3lNq7pP+tGAg+aE/7KsWbuGUhHwrzfQ=; b=jl/csNkBmc5UHxZ4ckD6xBqhBgOGIsq78HcfKNKozi8ETATftnd4OCU2C37SP2yFy4iGSl +dvC7BYt4yZMwmVr+o4I7QgLJ188hJCr7/hmt1gQGXG5qnJOKmXG9ZW+fc1BHGKtb8Eocw 0dRr/CZKiSGz1vjNo4hl96RHdvGtD8qO9dSbRI5lFqM7j9BIiYjRDZrAgMN2rqeJXtPCbO no9kl67yqbch/MjT6j2nN1mioBSDBoutEs1jH2pcGin0FdxXegdeBg1DMaUvIeGGpYNE7M rUgl9g9JgOODu0PN0RtRwxf564U83G5EFT7iJfKC2Ff5bqCOxZN6kOH1OBblrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698253006; a=rsa-sha256; cv=none; b=lzw5AlMbaUdIJ8vqgS8eBYwSnQ4KOM2hXbhh6N30FrYiaptpB5P8xOh26x3POO8X9cPJL1 wXDOZztre9G2EPw8MBZZMCqxMiNPXLk8K/9xGpKwOh8FO1hBYRi5VUKN/t6lovHRRBZrNM AQTMmlkkkIQn4KcUhWrkzAZ5kzmwCpIEcjFXz5vz5UFnYBH4y/3FBPMbUaxqDQolNaBLZq yssMUWtBIOp/86AqZG3Du+Vk0U7FYainfXBcB/cnbypWkOmHVjODNvAUFFPGbT8U4Ioo0F cCv/NmK973B0hhHvX/9lQ8xEF3A7cw5qGxKq9XSynQi5fHGCuB0tuu1VcBpyWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698253006; 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=bplNSAUK7iId3lNq7pP+tGAg+aE/7KsWbuGUhHwrzfQ=; b=NBIdBN2gIYgpTIPPoY6NJcFI5jknAMqP4MhBMT376uop9AO6L2acPxSjo2EGCEdWSEpaCC uWi4q/Jht1Smkoo5Y2dnrMdQ8v2Fz8u491Mp54WPjWm/EAXsJIEtrk5uUNzmQ2sALyeZG6 79NIemOwRakqEjOk26fS+BG7mxDoC0OjCtL2gc21c/+b9ouU53vfZpHmi/tCW91Qp49dcw ka6U99Lh88PgqIQpbtnd3b94bJqak5aI0MfA1W6dPy1F9Lkww5mQeCnqjknUig9/IeBkPR 2hCFNH8NYN4VUevn9VbDfdFwCUdhslMQtd6wUc/lXMdWw2AJNWo7yOYj1rdfig== 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 4SFw7f0VfQz1BBw; Wed, 25 Oct 2023 16:56:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39PGujYO022112; Wed, 25 Oct 2023 16:56:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39PGuj39022110; Wed, 25 Oct 2023 16:56:45 GMT (envelope-from git) Date: Wed, 25 Oct 2023 16:56:45 GMT Message-Id: <202310251656.39PGuj39022110@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 8f8e6f81f3df - releng/14.0 - makefs/zfs: Update dd_used_breakdown after writing the MOS 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.0 X-Git-Reftype: branch X-Git-Commit: 8f8e6f81f3dfefb9631a0845fd2c266ecd681e80 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8f8e6f81f3dfefb9631a0845fd2c266ecd681e80 commit 8f8e6f81f3dfefb9631a0845fd2c266ecd681e80 Author: Mark Johnston AuthorDate: 2023-10-23 16:25:20 +0000 Commit: Mark Johnston CommitDate: 2023-10-25 16:56:05 +0000 makefs/zfs: Update dd_used_breakdown after writing the MOS Approved by: re (gjb) Fixes: 96092bf9108c ("makefs/zfs: Fill out dd_used_breakdown fields in DSL directories") Sponsored by: The FreeBSD Foundation (cherry picked from commit c9c029507f80b31fb67b1b545f3062c7266d5f9e) --- usr.sbin/makefs/zfs/dsl.c | 18 ++++++++++++++++-- usr.sbin/makefs/zfs/objset.c | 3 +-- usr.sbin/makefs/zfs/zfs.h | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/usr.sbin/makefs/zfs/dsl.c b/usr.sbin/makefs/zfs/dsl.c index f7abebe2e245..93083f286e81 100644 --- a/usr.sbin/makefs/zfs/dsl.c +++ b/usr.sbin/makefs/zfs/dsl.c @@ -423,7 +423,7 @@ dsl_dir_alloc(zfs_opt_t *zfs, const char *name) return (dir); } -void +static void dsl_dir_size_add(zfs_dsl_dir_t *dir, uint64_t bytes) { dir->phys->dd_used_bytes += bytes; @@ -431,6 +431,19 @@ dsl_dir_size_add(zfs_dsl_dir_t *dir, uint64_t bytes) dir->phys->dd_uncompressed_bytes += bytes; } +/* + * See dsl_dir_root_finalize(). + */ +void +dsl_dir_root_finalize(zfs_opt_t *zfs, uint64_t bytes) +{ + dsl_dir_size_add(zfs->mosdsldir, bytes); + zfs->mosdsldir->phys->dd_used_breakdown[DD_USED_HEAD] += bytes; + + dsl_dir_size_add(zfs->rootdsldir, bytes); + zfs->rootdsldir->phys->dd_used_breakdown[DD_USED_CHILD] += bytes; +} + /* * Convert dataset properties into entries in the DSL directory's properties * ZAP. @@ -520,7 +533,8 @@ dsl_dir_finalize(zfs_opt_t *zfs, zfs_dsl_dir_t *dir, void *arg __unused) * The root directory needs a special case: the amount of * space used for the MOS isn't known until everything else is * finalized, so it can't be accounted in the MOS directory's - * parent until then. + * parent until then, at which point dsl_dir_root_finalize() is + * called. */ if (dir == zfs->rootdsldir && cdir == zfs->mosdsldir) continue; diff --git a/usr.sbin/makefs/zfs/objset.c b/usr.sbin/makefs/zfs/objset.c index 3e3dcdeced4b..6be732db477a 100644 --- a/usr.sbin/makefs/zfs/objset.c +++ b/usr.sbin/makefs/zfs/objset.c @@ -185,8 +185,7 @@ objset_write(zfs_opt_t *zfs, zfs_objset_t *os) * We've finished allocating space, account for it in $MOS and * in the parent directory. */ - dsl_dir_size_add(zfs->mosdsldir, os->space); - dsl_dir_size_add(zfs->rootdsldir, os->space); + dsl_dir_root_finalize(zfs, os->space); } _objset_write(zfs, os, c, dnodeloc); } diff --git a/usr.sbin/makefs/zfs/zfs.h b/usr.sbin/makefs/zfs/zfs.h index 193ca1248d89..9af090b14912 100644 --- a/usr.sbin/makefs/zfs/zfs.h +++ b/usr.sbin/makefs/zfs/zfs.h @@ -124,7 +124,7 @@ char *dsl_dir_get_mountpoint(zfs_opt_t *, zfs_dsl_dir_t *); bool dsl_dir_has_dataset(zfs_dsl_dir_t *); bool dsl_dir_dataset_has_objset(zfs_dsl_dir_t *); void dsl_dir_dataset_write(zfs_opt_t *, zfs_objset_t *, zfs_dsl_dir_t *); -void dsl_dir_size_add(zfs_dsl_dir_t *, uint64_t); +void dsl_dir_root_finalize(zfs_opt_t *, uint64_t); void dsl_write(zfs_opt_t *); /* fs.c */