Page MenuHomeFreeBSD

D44172.diff
No OneTemporary

D44172.diff

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -3332,6 +3332,8 @@
vget_finish_ref(struct vnode *vp, enum vgetstate vs)
{
int old;
+ struct mount *mp;
+ uint64_t *fsvninusep;
VNPASS(vs == VGET_HOLDCNT || vs == VGET_USECOUNT, vp);
VNPASS(vp->v_holdcnt > 0, vp);
@@ -3354,6 +3356,13 @@
#else
refcount_release(&vp->v_holdcnt);
#endif
+ } else {
+ mp = vp->v_mount;
+ if (NULL != mp) {
+ fsvninusep = mp->mnt_fsvninusep;
+ if (NULL != fsvninusep)
+ atomic_add_rel_64(fsvninusep, 1);
+ }
}
}
@@ -3515,10 +3524,23 @@
{
int error;
bool want_unlock;
+ struct mount *mp;
+ uint64_t *fsvninusep;
CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
VNPASS(vp->v_holdcnt > 0, vp);
+ mp = vp->v_mount;
+ /*
+ * The filesystem-local in-use vnode count is not incremented if
+ * insmntque() fails. vp->v_data is set to NULL in such the case.
+ */
+ if ((NULL != mp) && (NULL != vp->v_data)) {
+ fsvninusep = mp->mnt_fsvninusep;
+ if (NULL != fsvninusep)
+ atomic_subtract_rel_64(fsvninusep, 1);
+ }
+
VI_LOCK(vp);
/*
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -239,6 +239,7 @@
int mnt_secondary_writes; /* (i) # of secondary writes */
int mnt_secondary_accwrites;/* (i) secondary wr. starts */
struct thread *mnt_susp_owner; /* (i) thread owning suspension */
+ uint64_t *mnt_fsvninusep; /* per-filesystem count of vnodes in use */
#define mnt_endzero mnt_gjprovider
char *mnt_gjprovider; /* gjournal provider name */
struct mtx mnt_listmtx;

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 16, 12:50 PM (4 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29771071
Default Alt Text
D44172.diff (1 KB)

Event Timeline