22 pr_dinfo2(dcache_ref,
"dentry %p '%s' increased refcount to %zu", (
void *) dentry,
dentry_name(dentry).c_str(), dentry->
refcount.load());
32 if (cur->name.empty())
58 mos_warn(
"dentry refcount is already 0");
68 pr_dinfo2(vfs,
"inode %p has no more references, releasing", (
void *) dentry->
inode);
73 pr_dinfo2(dcache_ref,
"dentry %p '%s' decreased refcount to %zu", (
void *) dentry,
dentry_name(dentry).c_str(), dentry->
refcount.load());
81 pr_dinfo2(dcache_ref,
" mountpoint %p '%s' decreased mountpoint refcount to %zu", (
void *) mountpoint,
dentry_name(mountpoint).c_str(),
94 receiver(depth, dentry,
false, receiver_data);
99 receiver(depth, dentry,
true, receiver_data);
112 size_t expected_refcount = 0;
129 expected_refcount += child->refcount;
132 if (dentry->
refcount < expected_refcount)
134 mos_warn(
"dentry %p refcount %zu is less than expected refcount %zu", (
void *) dentry, dentry->
refcount.load(), expected_refcount);
137 pr_warn(
" child %p '%s' has %zu references", (
void *) child,
dentry_name(child).c_str(), child->refcount.load());
139 mos_panic(
"don't know how to handle this");
141 else if (dentry->
refcount - expected_refcount)
143 pr_dinfo2(dcache_ref,
" dentry %p '%s' has %zu direct references", (
void *) dentry,
dentry_name(dentry).c_str(), dentry->refcount - expected_refcount);
182 auto path = dentry->
name;
193 path =
current->name +
"/" + path;
#define mos_warn(fmt,...)
void dentry_dump_refstat(const dentry_t *dentry, dump_refstat_receiver_t *receiver, void *receiver_data)
std::optional< mos::string > dentry_path(const dentry_t *dentry, dentry_t *root)
Get the path of a dentry.
dentry_t * dentry_ref_up_to(dentry_t *dentry, dentry_t *root)
Increment the reference count of a dentry up to a given dentry.
void dump_refstat_receiver_t(int depth, const dentry_t *dentry, bool mountroot, void *data)
void dentry_try_release(dentry_t *dentry)
should_inline dentry_t * dentry_parent(const dentry_t &dentry)
dentry_t * dentry_ref(dentry_t *dentry)
Increment the reference count of a dentry.
void dentry_check_refstat(const dentry_t *dentry)
Check the reference count of a dentry.
void dentry_unref(dentry_t *dentry)
Decrement the reference count of a dentry.
__nodiscard bool dentry_unref_one_norelease(dentry_t *dentry)
Decrease the refcount of ONE SINGLE dentry, including (if it's a mountpoint) the mountpoint dentry.
MOSAPI bool list_is_empty(const list_node_t *head)
#define list_remove(element)
void inode_ref(inode_t *inode)
bool inode_unref(inode_t *inode)
dentry_t * dentry_root_get_mountpoint(const dentry_t *dentry)
Given a mounted root dentry, return the mountpoint dentry that points to it.
ptr< mount_t > dentry_get_mount(const dentry_t *dentry)
#define mos_panic(fmt,...)
#define pr_dinfo2(feat, fmt,...)
#define tree_node(element)
#define tree_foreach_child(t, v, h)
mos::string dentry_name(const dentry_t *dentry)