Skip to content

Commit

Permalink
16203 zfs: switch refcount tracking from lists to AVL-trees
Browse files Browse the repository at this point in the history
Reviewed by: Andy Fiddaman <illumos@fiddaman.net>
Reviewed by: Bill Sommerfeld <sommerfeld@hamachi.org>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Dan McDonald <danmcd@mnx.io>
  • Loading branch information
amotin authored and citrus-it committed Apr 9, 2024
1 parent 3133214 commit 9a8c528
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 136 deletions.
9 changes: 5 additions & 4 deletions usr/src/cmd/mdb/common/modules/zfs/zfs.c
Expand Up @@ -23,6 +23,7 @@
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2011, 2018 by Delphix. All rights reserved.
* Copyright 2020 Joyent, Inc.
* Copyright 2024 Oxide Computer Company
*/

/* Portions Copyright 2010 Robert Milkowski */
Expand Down Expand Up @@ -3325,7 +3326,7 @@ typedef struct mdb_zfs_refcount {
} mdb_zfs_refcount_t;

typedef struct mdb_zfs_refcount_removed {
uint64_t rc_removed_count;
uint_t rc_removed_count;
} mdb_zfs_refcount_removed_t;

typedef struct mdb_zfs_refcount_tracked {
Expand Down Expand Up @@ -3373,18 +3374,18 @@ zfs_refcount(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)

if (rct.rc_tracked && rc.rc_count > 0)
mdb_printf("current holds:\n");
off = mdb_ctf_offsetof_by_name("zfs_refcount_t", "rc_list");
off = mdb_ctf_offsetof_by_name("zfs_refcount_t", "rc_tree");
if (off == -1)
return (DCMD_ERR);
mdb_pwalk("list", reference_cb, (void*)B_FALSE, addr + off);
mdb_pwalk("avl", reference_cb, (void *)B_FALSE, addr + off);

if (released && rcr.rc_removed_count > 0) {
mdb_printf("released holds:\n");

off = mdb_ctf_offsetof_by_name("zfs_refcount_t", "rc_removed");
if (off == -1)
return (DCMD_ERR);
mdb_pwalk("list", reference_cb, (void*)B_TRUE, addr + off);
mdb_pwalk("list", reference_cb, (void *)B_TRUE, addr + off);
}

return (DCMD_OK);
Expand Down
1 change: 1 addition & 0 deletions usr/src/lib/libzpool/common/sys/zfs_context.h
Expand Up @@ -293,6 +293,7 @@ extern vnode_t *rootdir;
#endif

#define likely(x) _zfs_expect((x) != 0, 1)
#define unlikely(x) _zfs_expect((x) != 0, 0)

#define CPU_SEQID (thr_self() & (max_ncpus - 1))

Expand Down

0 comments on commit 9a8c528

Please sign in to comment.