diff options
author | Rob Norris <[email protected]> | 2023-06-15 17:19:41 +1000 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2024-08-16 12:02:56 -0700 |
commit | 27e9cb5f8022bef72553cbe12f7ec292535e4c0b (patch) | |
tree | 556ac24e47c7a1029fc46df3cc31008b5ffe6db0 /include/sys/ddt_impl.h | |
parent | f4aeb23f521cb4c5d94b103c926a3cc7b7be8abc (diff) |
ddt: cleanup the stats & histogram code
Both the API and the code were kinda mangled and I was really struggling
to follow it. The worst offender was the old ddt_stat_add(); after
fixing it up the rest of the changes are mostly knock-on effects and
targets of opportunity.
Note that the old ddt_stat_add() was safe against overflows - it could
produce crazy numbers, but the compiler wouldn't do anything stupid. The
assertions in ddt_stat_sub() go a lot of the way to protecting against
this; getting in a position where overflows are a problem is definitely
a programming error.
Also expanding ddt_stat_add() and ddt_histogram_empty() produces less
efficient assembly. I'm not bothered about this right now though; these
should not be hot functions, and if they are we'll optimise them later.
If we have to go back to the old form, we'll comment it like crazy.
Finally, I've removed the assertion that the bucket will never be
negative, as it will soon be possible to have entries with zero
refcounts: an entry for a block that is no longer on the pool, but is on
the log waiting to be synced out. It might be better to have a separate
bucket for these, since they're still using real space on disk, but
ultimately these stats are driving UI, and for now I've chosen to keep
them matching how they've looked in the past, as well as match the
operators mental model - pool usage is managed elsewhere.
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Sponsored-by: Klara, Inc.
Sponsored-by: iXsystems, Inc.
Closes #15895
Diffstat (limited to 'include/sys/ddt_impl.h')
-rw-r--r-- | include/sys/ddt_impl.h | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/include/sys/ddt_impl.h b/include/sys/ddt_impl.h index c4e681fb1..ce4bc559d 100644 --- a/include/sys/ddt_impl.h +++ b/include/sys/ddt_impl.h @@ -77,8 +77,6 @@ typedef struct { extern const ddt_ops_t ddt_zap_ops; -extern void ddt_stat_update(ddt_t *ddt, ddt_entry_t *dde, uint64_t neg); - /* * These are only exposed so that zdb can access them. Try not to use them * outside of the DDT implementation proper, and if you do, consider moving @@ -95,8 +93,6 @@ extern uint64_t ddt_phys_total_refcnt(const ddt_t *ddt, const ddt_entry_t *dde); extern void ddt_key_fill(ddt_key_t *ddk, const blkptr_t *bp); -extern void ddt_stat_add(ddt_stat_t *dst, const ddt_stat_t *src, uint64_t neg); - extern void ddt_object_name(ddt_t *ddt, ddt_type_t type, ddt_class_t clazz, char *name); extern int ddt_object_walk(ddt_t *ddt, ddt_type_t type, ddt_class_t clazz, |