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 <alexander.motin@TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@truenas.com>
Closes #18630
This commit is contained in:
Rob Norris
2026-06-04 23:37:10 +10:00
committed by Brian Behlendorf
parent cab50d5adb
commit 9ff3fdfc54
3 changed files with 1 additions and 14 deletions
-2
View File
@@ -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,
+1 -1
View File
@@ -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);
-11
View File
@@ -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);