diff options
author | attilio <attilio@FreeBSD.org> | 2008-11-03 20:00:35 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2008-11-03 20:00:35 +0000 |
commit | 26a604f3bccb7c4a377c7cbf4facbae8c20e1fed (patch) | |
tree | 51374f893e6d2ba20ae55ec543453eb22efd981b | |
parent | 6cfec3e1612f60d19983a6ab0defbecbfd07a12d (diff) | |
download | FreeBSD-src-26a604f3bccb7c4a377c7cbf4facbae8c20e1fed.zip FreeBSD-src-26a604f3bccb7c4a377c7cbf4facbae8c20e1fed.tar.gz |
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
-rw-r--r-- | sys/kern/vfs_mount.c | 21 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 2 | ||||
-rw-r--r-- | sys/sys/mount.h | 2 |
3 files changed, 3 insertions, 22 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 4285b4c..2421260 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -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); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 30ee61a..327a9c5 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -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); diff --git a/sys/sys/mount.h b/sys/sys/mount.h index bd56521..038cbc7 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -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 */ |