summaryrefslogtreecommitdiffstats
path: root/sys/fs/msdosfs
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2002-08-04 10:29:36 +0000
committerjeff <jeff@FreeBSD.org>2002-08-04 10:29:36 +0000
commit02517b6731ab2da44ce9b49260429744cf0114d5 (patch)
treee889f56910bf98cbee3be239655a9e4bbb928b2e /sys/fs/msdosfs
parenta03ca02ee99a255a2c14a75ff8eb488960b13ea7 (diff)
downloadFreeBSD-src-02517b6731ab2da44ce9b49260429744cf0114d5.zip
FreeBSD-src-02517b6731ab2da44ce9b49260429744cf0114d5.tar.gz
- Replace v_flag with v_iflag and v_vflag
- v_vflag is protected by the vnode lock and is used when synchronization with VOP calls is needed. - v_iflag is protected by interlock and is used for dealing with vnode management issues. These flags include X/O LOCK, FREE, DOOMED, etc. - All accesses to v_iflag and v_vflag have either been locked or marked with mp_fixme's. - Many ASSERT_VOP_LOCKED calls have been added where the locking was not clear. - Many functions in vfs_subr.c were restructured to provide for stronger locking. Idea stolen from: BSD/OS
Diffstat (limited to 'sys/fs/msdosfs')
-rw-r--r--sys/fs/msdosfs/msdosfs_denode.c6
-rw-r--r--sys/fs/msdosfs/msdosfs_lookup.c2
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c5
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c9
4 files changed, 14 insertions, 8 deletions
diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c
index 7a0cf79..02b188f 100644
--- a/sys/fs/msdosfs/msdosfs_denode.c
+++ b/sys/fs/msdosfs/msdosfs_denode.c
@@ -300,7 +300,7 @@ deget(pmp, dirclust, diroffset, depp)
* exists), and then use the time and date from that entry
* as the time and date for the root denode.
*/
- nvp->v_flag |= VROOT; /* should be further down XXX */
+ nvp->v_vflag |= VV_ROOT; /* should be further down XXX */
ldep->de_Attributes = ATTR_DIRECTORY;
ldep->de_LowerCase = 0;
@@ -442,7 +442,7 @@ detrunc(dep, length, flags, cred, td)
* recognize the root directory at this point in a file or
* directory's life.
*/
- if ((DETOV(dep)->v_flag & VROOT) && !FAT32(pmp)) {
+ if ((DETOV(dep)->v_vflag & VV_ROOT) && !FAT32(pmp)) {
printf("detrunc(): can't truncate root directory, clust %ld, offset %ld\n",
dep->de_dirclust, dep->de_diroffset);
return (EINVAL);
@@ -575,7 +575,7 @@ deextend(dep, length, cred)
/*
* The root of a DOS filesystem cannot be extended.
*/
- if ((DETOV(dep)->v_flag & VROOT) && !FAT32(pmp))
+ if ((DETOV(dep)->v_vflag & VV_ROOT) && !FAT32(pmp))
return (EINVAL);
/*
diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c
index 79b0589..00598c8 100644
--- a/sys/fs/msdosfs/msdosfs_lookup.c
+++ b/sys/fs/msdosfs/msdosfs_lookup.c
@@ -136,7 +136,7 @@ msdosfs_lookup(ap)
* they won't find it. DOS filesystems don't have them in the root
* directory. So, we fake it. deget() is in on this scam too.
*/
- if ((vdp->v_flag & VROOT) && cnp->cn_nameptr[0] == '.' &&
+ if ((vdp->v_vflag & VV_ROOT) && cnp->cn_nameptr[0] == '.' &&
(cnp->cn_namelen == 1 ||
(cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.'))) {
isadir = ATTR_DIRECTORY;
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index f62b0c7..0ad34a0 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -632,8 +632,9 @@ msdosfs_unmount(mp, mntflags, td)
struct vnode *vp = pmp->pm_devvp;
printf("msdosfs_umount(): just before calling VOP_CLOSE()\n");
- printf("flag %08lx, usecount %d, writecount %d, holdcnt %ld\n",
- vp->v_flag, vp->v_usecount, vp->v_writecount, vp->v_holdcnt);
+ printf("iflag %08lx, usecount %d, writecount %d, holdcnt %ld\n",
+ vp->vi_flag, vp->v_usecount, vp->v_writecount,
+ vp->v_holdcnt);
printf("id %lu, mount %p, op %p\n",
vp->v_id, vp->v_mount, vp->v_op);
printf("freef %p, freeb %p, mount %p\n",
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 0a5cc48..210e9a8 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -815,6 +815,7 @@ msdosfs_fsync(ap)
*/
loop:
s = splbio();
+ VI_LOCK(vp);
for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
nbp = TAILQ_NEXT(bp, b_vnbufs);
if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT))
@@ -823,13 +824,17 @@ loop:
panic("msdosfs_fsync: not dirty");
bremfree(bp);
splx(s);
+ VI_UNLOCK(vp);
+ /* XXX Could do bawrite */
(void) bwrite(bp);
goto loop;
}
while (vp->v_numoutput) {
- vp->v_flag |= VBWAIT;
- (void) tsleep((caddr_t)&vp->v_numoutput, PRIBIO + 1, "msdosfsn", 0);
+ vp->v_vflag |= VI_BWAIT;
+ (void) msleep((caddr_t)&vp->v_numoutput, VI_MTX(vp),
+ PRIBIO + 1, "msdosfsn", 0);
}
+ VI_UNLOCK(vp);
#ifdef DIAGNOSTIC
if (!TAILQ_EMPTY(&vp->v_dirtyblkhd)) {
vprint("msdosfs_fsync: dirty", vp);
OpenPOWER on IntegriCloud