From 9ff3fdfc54d69792a60871aaac09d610c762cc10 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Thu, 4 Jun 2026 23:37:10 +1000 Subject: [PATCH] zap: remove zap_increment_int() This is a strange function that can't possibly work sensibly with zap_add_int()/zap_remove_int()/zap_lookup_int(), as it allows the key and value to diverge, which is not how these functions appear to work. It would make more sense if it were called zap_increment_int_key(), as that family can have divergent key and value. But it doesn't. Fortunately, nothing uses it. There was a function named zap_increment_int() in Sun ZFS, that was renamed to zap_increment() early in ZoL's lifetime, and is unrelated. So, remove it, and fix up some very old comments referring to it. Sponsored-by: TrueNAS Reviewed-by: Alexander Motin Reviewed-by: Brian Behlendorf Signed-off-by: Rob Norris Closes #18630 --- include/sys/zap.h | 2 -- module/zfs/dmu_objset.c | 2 +- module/zfs/zap.c | 11 ----------- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/include/sys/zap.h b/include/sys/zap.h index ad20d427ad9..cde4c72764a 100644 --- a/include/sys/zap.h +++ b/include/sys/zap.h @@ -402,8 +402,6 @@ int zap_join_increment(objset_t *os, uint64_t fromobj, uint64_t intoobj, int zap_add_int(objset_t *os, uint64_t obj, uint64_t value, dmu_tx_t *tx); int zap_remove_int(objset_t *os, uint64_t obj, uint64_t value, dmu_tx_t *tx); int zap_lookup_int(objset_t *os, uint64_t obj, uint64_t value); -int zap_increment_int(objset_t *os, uint64_t obj, uint64_t key, int64_t delta, - dmu_tx_t *tx); /* Here the key is an int and the value is a different int. */ int zap_add_int_key(objset_t *os, uint64_t obj, diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c index 4919ead3cea..654afe2f844 100644 --- a/module/zfs/dmu_objset.c +++ b/module/zfs/dmu_objset.c @@ -1859,7 +1859,7 @@ do_userquota_cacheflush(objset_t *os, userquota_cache_t *cache, dmu_tx_t *tx) &cookie)) != NULL) { /* * os_userused_lock protects against concurrent calls to - * zap_increment_int(). It's needed because zap_increment_int() + * zap_increment(). It's needed because zap_increment() * is not thread-safe (i.e. not atomic). */ mutex_enter(&os->os_userused_lock); diff --git a/module/zfs/zap.c b/module/zfs/zap.c index ee94917d8e8..e14ff1027f6 100644 --- a/module/zfs/zap.c +++ b/module/zfs/zap.c @@ -1029,16 +1029,6 @@ zap_lookup_int(objset_t *os, uint64_t obj, uint64_t value) return (zap_lookup(os, obj, name, 8, 1, &value)); } -int -zap_increment_int(objset_t *os, uint64_t obj, uint64_t key, int64_t delta, - dmu_tx_t *tx) -{ - char name[20]; - - (void) snprintf(name, sizeof (name), "%llx", (longlong_t)key); - return (zap_increment(os, obj, name, delta, tx)); -} - /* zap_*_int_key */ int @@ -1329,7 +1319,6 @@ EXPORT_SYMBOL(zap_join_increment); EXPORT_SYMBOL(zap_add_int); EXPORT_SYMBOL(zap_remove_int); EXPORT_SYMBOL(zap_lookup_int); -EXPORT_SYMBOL(zap_increment_int); EXPORT_SYMBOL(zap_add_int_key); EXPORT_SYMBOL(zap_lookup_int_key); EXPORT_SYMBOL(zap_increment);