Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Nov 2008 20:00:35 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r184599 - in head/sys: kern sys
Message-ID:  <200811032000.mA3K0Zok074801@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Mon Nov  3 20:00:35 2008
New Revision: 184599
URL: http://svn.freebsd.org/changeset/base/184599

Log:
  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

Modified:
  head/sys/kern/vfs_mount.c
  head/sys/kern/vfs_subr.c
  head/sys/sys/mount.h

Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c	Mon Nov  3 19:57:40 2008	(r184598)
+++ head/sys/kern/vfs_mount.c	Mon Nov  3 20:00:35 2008	(r184599)
@@ -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, st
 		*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, st
 		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 **mv
 	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);
 }
 
 

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Mon Nov  3 19:57:40 2008	(r184598)
+++ head/sys/kern/vfs_subr.c	Mon Nov  3 20:00:35 2008	(r184599)
@@ -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);

Modified: head/sys/sys/mount.h
==============================================================================
--- head/sys/sys/mount.h	Mon Nov  3 19:57:40 2008	(r184598)
+++ head/sys/sys/mount.h	Mon Nov  3 20:00:35 2008	(r184599)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811032000.mA3K0Zok074801>