Remove the mnt_holdcnt and mnt_holdcntwaiters because they are useless.

Really, the concept of holdcnt in the struct mount is rappresented by
the mnt_ref (which prevents the type-stable structure from being
"recycled) handled through vfs_ref() and vfs_rel().
On this optic, switch the holdcnt acquisition into an emulated vfs_ref()
(and subsequent release into vfs_rel()).

Discussed with:	kib
Tested by:	pho
This commit is contained in:
attilio 2008-11-03 20:00:35 +00:00
parent 6cfec3e161
commit 26a604f3bc
3 changed files with 3 additions and 22 deletions

View File

@ -509,16 +509,6 @@ vfs_mount_destroy(struct mount *mp)
MNT_ILOCK(mp);
while (mp->mnt_ref)
msleep(mp, MNT_MTX(mp), PVFS, "mntref", 0);
if (mp->mnt_holdcnt != 0) {
printf("Waiting for mount point to be unheld\n");
while (mp->mnt_holdcnt != 0) {
mp->mnt_holdcntwaiters++;
msleep(&mp->mnt_holdcnt, MNT_MTX(mp),
PZERO, "mntdestroy", 0);
mp->mnt_holdcntwaiters--;
}
printf("mount point unheld\n");
}
if (mp->mnt_writeopcount > 0) {
printf("Waiting for mount point write ops\n");
while (mp->mnt_writeopcount > 0) {
@ -2062,7 +2052,7 @@ __mnt_vnode_first(struct vnode **mvp, struct mount *mp)
*mvp = NULL;
return (NULL);
}
mp->mnt_holdcnt++;
MNT_REF(mp);
MNT_IUNLOCK(mp);
*mvp = (struct vnode *) malloc(sizeof(struct vnode),
M_VNODE_MARKER,
@ -2080,9 +2070,7 @@ __mnt_vnode_first(struct vnode **mvp, struct mount *mp)
free(*mvp, M_VNODE_MARKER);
MNT_ILOCK(mp);
*mvp = NULL;
mp->mnt_holdcnt--;
if (mp->mnt_holdcnt == 0 && mp->mnt_holdcntwaiters != 0)
wakeup(&mp->mnt_holdcnt);
MNT_REL(mp);
return (NULL);
}
(*mvp)->v_mount = mp;
@ -2106,10 +2094,7 @@ __mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp)
free(*mvp, M_VNODE_MARKER);
MNT_ILOCK(mp);
*mvp = NULL;
mp->mnt_holdcnt--;
if (mp->mnt_holdcnt == 0 && mp->mnt_holdcntwaiters != 0)
wakeup(&mp->mnt_holdcnt);
MNT_REL(mp);
}

View File

@ -2838,8 +2838,6 @@ DB_SHOW_COMMAND(mount, db_show_mount)
db_printf(" mnt_maxsymlinklen = %d\n", mp->mnt_maxsymlinklen);
db_printf(" mnt_iosize_max = %d\n", mp->mnt_iosize_max);
db_printf(" mnt_hashseed = %u\n", mp->mnt_hashseed);
db_printf(" mnt_holdcnt = %d\n", mp->mnt_holdcnt);
db_printf(" mnt_holdcntwaiters = %d\n", mp->mnt_holdcntwaiters);
db_printf(" mnt_secondary_writes = %d\n", mp->mnt_secondary_writes);
db_printf(" mnt_secondary_accwrites = %d\n",
mp->mnt_secondary_accwrites);

View File

@ -174,8 +174,6 @@ struct mount {
struct label *mnt_label; /* MAC label for the fs */
u_int mnt_hashseed; /* Random seed for vfs_hash */
int mnt_lockref; /* (i) Lock reference count */
int mnt_holdcnt; /* hold count */
int mnt_holdcntwaiters; /* waits on hold count */
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 */