mzap_create_impl: use zap_lock_by_dnode()

The only reason this used zap_lock_impl() directly was to avoid an extra
dbuf hold, but there's no real reason to do that. Just use
zap_lock_by_dnode(), and then zap_lock_impl() can be de-exported.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@truenas.com>
Closes #18546
This commit is contained in:
Rob Norris
2026-05-13 15:38:27 +10:00
committed by Brian Behlendorf
parent d3523f9093
commit 18d910bd2c
3 changed files with 5 additions and 10 deletions
-4
View File
@@ -255,10 +255,6 @@ int zap_lock_by_dnode(dnode_t *dn, dmu_tx_t *tx,
krw_t lti, boolean_t fatreader, boolean_t adding, const void *tag,
zap_t **zapp);
/* Underlying implementation for above; do not use. */
int zap_lock_impl(dnode_t *dn, dmu_buf_t *db, const void *tag, dmu_tx_t *tx,
krw_t lti, boolean_t fatreader, boolean_t adding, zap_t **zapp);
/* Unlock and release a zap_t. */
void zap_unlock(zap_t *zap, const void *tag);
+1 -1
View File
@@ -289,7 +289,7 @@ zap_hash(zap_name_t *zn)
* This routine "consumes" the caller's hold on the dbuf, which must
* have the specified tag.
*/
int
static int
zap_lock_impl(dnode_t *dn, dmu_buf_t *db, const void *tag, dmu_tx_t *tx,
krw_t lti, boolean_t fatreader, boolean_t adding, zap_t **zapp)
{
+4 -5
View File
@@ -405,14 +405,13 @@ mzap_create_impl(dnode_t *dn, int normflags, zap_flags_t flags, dmu_tx_t *tx)
if (flags != 0) {
zap_t *zap;
/* Only fat zap supports flags; upgrade immediately. */
VERIFY(dnode_add_ref(dn, FTAG));
VERIFY0(zap_lock_impl(dn, db, FTAG, tx, RW_WRITER,
B_FALSE, B_FALSE, &zap));
VERIFY0(zap_lock_by_dnode(dn, tx,
RW_WRITER, B_FALSE, B_FALSE, FTAG, &zap));
VERIFY0(mzap_upgrade(&zap, FTAG, tx, flags));
zap_unlock(zap, FTAG);
} else {
dmu_buf_rele(db, FTAG);
}
dmu_buf_rele(db, FTAG);
}
/*