From nobody Mon Nov 04 19:24:58 2024 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 4Xj1d70tknz5cSQd; Mon, 04 Nov 2024 19:24:59 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xj1d709Fwz4GqS; Mon, 4 Nov 2024 19:24:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730748299; 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=9fta5UhJEUyPP0G+U3OPHIrDgr1QBLnYnVXqyCHOZkI=; b=FLnlqsPAjef7a0hpxoQwk00MPsF8hrzac984wznUwgCj8FjaD1axOA1lLQw5aUhS6cUrSb 0vkS+9GGHnZXi2mJFoV8MrzC4scYrThW1ZW5WM9llF+beaDkqPrQCEW9J2g5hyscm/B9kx eLlvXAV/SCehEc9urrtw7FNYBDd0mR2jbBt5OZWX3zOigyKrFXqwQQ+LMjTomxxDLc4Du4 g4B33esoDRF6yHxXPqBhm4TP/GaO+NkMJ6k9hK43hZmpSoFHYo+vRP/h7cY40MDgu5f6Ta zayqurAzb7VXO7cg4xTuXRa0hpJycG2kbbUiftxtRnAwD7Zaz3npXBHZn/gY+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730748299; 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=9fta5UhJEUyPP0G+U3OPHIrDgr1QBLnYnVXqyCHOZkI=; b=qW0ulcwyeOl2fhmP5lZ1vBGEIYjxO3S3nIblguyLISnieWAgKaqvCtVd8YACJ9sBL/ikqo Gi8PdtQINkuOMoJYWCvWMCPJpRvIF3JhXnAjJ40OthOuh+Ds3qIzkQTklrI0Q5b3P+1Vzd +3vOElQMBOaEK5Cj3YRV4pSPEAD36TZ8SDi2oBvH3+BtkZ0lyrqKpdggD7P4jXbTA7Z6Py J1cnLaMzDhe/w5zqEcekkouoSq3OrF5VWGwTaZ9+rEP3PBvZbz7t2+ksbI/cNxLKuVbRyh IA6fVRTUPx+KHu7n9JNWF+AwrgX4yu+8PIwUA9F09Vbh4eoFDmFl3ITvZQUNyw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730748299; a=rsa-sha256; cv=none; b=Mecvprj4Zc9H1pmOFOud8DkypItDXa4jlMIAkJ0OtKbtLYW06yHr72NgK6lfVAYZwF11N8 4M0gzlPQCExiZtZRGepuqFFts4P2b0tj6HmYedM2SFHKcngVZZ9Dmh5WLufTGR7GaqUq4w z76ouWsExlr+pZSip4T4uSmCSSeq/5FFg0sA8x+T6H1dXGUxtWAU8C5Ay7QS0Dx2Nsd+yi kn8whcTSE0ArRvXTfHRRFh/XEePoPYCDgHWuv6ghyZjRrOzLKUc4kdRZL9Bn2rC4O8KaE1 fivX7Ae7oK8r1vqpogGwaJ4jPuMxFl7kKFOMXPS++/Zxrtjf4kyKFe2ItPirQg== 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 4Xj1d66v04zmL4; Mon, 4 Nov 2024 19:24:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4A4JOwQY063694; Mon, 4 Nov 2024 19:24:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A4JOwXj063691; Mon, 4 Nov 2024 19:24:58 GMT (envelope-from git) Date: Mon, 4 Nov 2024 19:24:58 GMT Message-Id: <202411041924.4A4JOwXj063691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: a905c589be67 - main - pctrie: breakup pctrie_root_store 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a905c589be67db98bbb9c99932511be70e5027fb Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=a905c589be67db98bbb9c99932511be70e5027fb commit a905c589be67db98bbb9c99932511be70e5027fb Author: Doug Moore AuthorDate: 2024-11-04 19:23:40 +0000 Commit: Doug Moore CommitDate: 2024-11-04 19:23:40 +0000 pctrie: breakup pctrie_root_store Break up pctrie_root_store into the part that casts the root to a smr_pctnode_t *, and the rest. The rest is just pctrie_node_store, and the casting part can be used in a few more places. This is strictly a code-cleanup change, with no functional change expected. Reviewed by: bnovkov Differential Revision: https://reviews.freebsd.org/D47347 --- sys/kern/subr_pctrie.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/sys/kern/subr_pctrie.c b/sys/kern/subr_pctrie.c index e4865c602ce4..a078f0587f37 100644 --- a/sys/kern/subr_pctrie.c +++ b/sys/kern/subr_pctrie.c @@ -168,22 +168,21 @@ pctrie_node_store(smr_pctnode_t *p, void *v, enum pctrie_access access) } /* - * Get the root node for a tree. + * Get the root address, cast to proper type for load/store. */ -static __inline struct pctrie_node * -pctrie_root_load(struct pctrie *ptree, smr_t smr, enum pctrie_access access) +static __inline smr_pctnode_t * +pctrie_root(struct pctrie *ptree) { - return (pctrie_node_load((smr_pctnode_t *)&ptree->pt_root, smr, access)); + return ((smr_pctnode_t *)&ptree->pt_root); } /* - * Set the root node for a tree. + * Get the root node for a tree. */ -static __inline void -pctrie_root_store(struct pctrie *ptree, struct pctrie_node *node, - enum pctrie_access access) +static __inline struct pctrie_node * +pctrie_root_load(struct pctrie *ptree, smr_t smr, enum pctrie_access access) { - pctrie_node_store((smr_pctnode_t *)&ptree->pt_root, node, access); + return (pctrie_node_load(pctrie_root(ptree), smr, access)); } /* @@ -304,7 +303,7 @@ pctrie_insert_lookup_compound(struct pctrie *ptree, uint64_t *val, if (pctrie_isleaf(node)) { if (node == PCTRIE_NULL) { if (parent == NULL) - pctrie_root_store(ptree, + pctrie_node_store(pctrie_root(ptree), pctrie_toleaf(val), PCTRIE_LOCKED); else pctrie_addnode(parent, index, @@ -354,8 +353,7 @@ pctrie_insert_lookup_compound(struct pctrie *ptree, uint64_t *val, * children 'node' and 'val'. Return the place that points to 'node' * now, and will point to to the new branching node later. */ - return ((parent != NULL) ? &parent->pn_child[slot]: - (smr_pctnode_t *)&ptree->pt_root); + return ((parent == NULL) ? pctrie_root(ptree): &parent->pn_child[slot]); } /* @@ -608,7 +606,7 @@ pctrie_iter_insert_lookup(struct pctrie_iter *it, uint64_t *val) node = _pctrie_iter_lookup_node(it, *val, NULL, PCTRIE_LOCKED); if (node == PCTRIE_NULL) { if (it->top == 0) - pctrie_root_store(it->ptree, + pctrie_node_store(pctrie_root(it->ptree), pctrie_toleaf(val), PCTRIE_LOCKED); else pctrie_addnode(it->path[it->top - 1], it->index, @@ -625,7 +623,7 @@ pctrie_iter_insert_lookup(struct pctrie_iter *it, uint64_t *val) * now, and will point to to the new branching node later. */ if (it->top == 0) - return ((smr_pctnode_t *)&it->ptree->pt_root); + return (pctrie_root(it->ptree)); node = it->path[it->top - 1]; return (&node->pn_child[pctrie_slot(node, it->index)]); } @@ -1037,7 +1035,8 @@ pctrie_remove(struct pctrie *ptree, uint64_t index, struct pctrie_node *parent, int slot; if (node == NULL) { - pctrie_root_store(ptree, PCTRIE_NULL, PCTRIE_LOCKED); + pctrie_node_store(pctrie_root(ptree), + PCTRIE_NULL, PCTRIE_LOCKED); return; } slot = pctrie_slot(node, index); @@ -1054,7 +1053,7 @@ pctrie_remove(struct pctrie *ptree, uint64_t index, struct pctrie_node *parent, KASSERT(child != PCTRIE_NULL, ("%s: bad popmap slot %d in node %p", __func__, slot, node)); if (parent == NULL) - pctrie_root_store(ptree, child, PCTRIE_LOCKED); + pctrie_node_store(pctrie_root(ptree), child, PCTRIE_LOCKED); else { slot = pctrie_slot(parent, index); KASSERT(node == @@ -1218,7 +1217,7 @@ pctrie_reclaim_begin_compound(struct pctrie_node **pnode, struct pctrie_node *node; node = pctrie_root_load(ptree, NULL, PCTRIE_UNSERIALIZED); - pctrie_root_store(ptree, PCTRIE_NULL, PCTRIE_UNSERIALIZED); + pctrie_node_store(pctrie_root(ptree), PCTRIE_NULL, PCTRIE_UNSERIALIZED); if (pctrie_isleaf(node)) { if (callback != NULL && node != PCTRIE_NULL) callback(pctrie_toptr(node, keyoff), arg); @@ -1275,7 +1274,7 @@ pctrie_replace(struct pctrie *ptree, uint64_t *newval) if (pctrie_isleaf(node)) { if ((m = pctrie_toval(node)) != NULL && *m == index) { if (parent == NULL) - pctrie_root_store(ptree, + pctrie_node_store(pctrie_root(ptree), leaf, PCTRIE_LOCKED); else pctrie_node_store(