From 6110b03d2438de0cb3f47dbce3cec5c1dfa712f6 Mon Sep 17 00:00:00 2001 From: bp Date: Mon, 25 Sep 2000 15:24:04 +0000 Subject: Add a lock structure to vnode structure. Previously it was either allocated separately (nfs, cd9660 etc) or keept as a first element of structure referenced by v_data pointer(ffs). Such organization leads to known problems with stacked filesystems. From this point vop_no*lock*() functions maintain only interlock lock. vop_std*lock*() functions maintain built-in v_lock structure using lockmgr(). vop_sharedlock() is compatible with vop_stdunlock(), but maintains a shared lock on vnode. If filesystem wishes to export lockmgr compatible lock, it can put an address of this lock to v_vnlock field. This indicates that the upper filesystem can take advantage of it and use single lock structure for entire (or part) of stack of vnodes. This field shouldn't be examined or modified by VFS code except for initialization purposes. Reviewed in general by: mckusick --- sys/ufs/ufs/inode.h | 1 - sys/ufs/ufs/ufs_ihash.c | 2 +- sys/ufs/ufs/ufs_vnops.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'sys/ufs/ufs') diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index 6417a10..79e79b1 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -66,7 +66,6 @@ typedef long ufs_lbn_t; * active, and is put back when the file is no longer being used. */ struct inode { - struct lock i_lock; /* Inode lock. >Keep this first< */ LIST_ENTRY(inode) i_hash;/* Hash chain. */ struct vnode *i_vnode;/* Vnode associated with this inode. */ struct vnode *i_devvp;/* Vnode for block I/O. */ diff --git a/sys/ufs/ufs/ufs_ihash.c b/sys/ufs/ufs/ufs_ihash.c index 0a7c7d5..36176f0 100644 --- a/sys/ufs/ufs/ufs_ihash.c +++ b/sys/ufs/ufs/ufs_ihash.c @@ -130,7 +130,7 @@ ufs_ihashins(ip) struct ihashhead *ipp; /* lock the inode, then put it on the appropriate hash list */ - lockmgr(&ip->i_lock, LK_EXCLUSIVE, (struct simplelock *)0, p); + lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct simplelock *)0, p); simple_lock(&ufs_ihash_slock); ipp = INOHASH(ip->i_dev, ip->i_number); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 2b34d3c..fe8de37 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1782,7 +1782,7 @@ ufs_print(ap) minor(ip->i_dev)); if (vp->v_type == VFIFO) fifo_printinfo(vp); - lockmgr_printinfo(&ip->i_lock); + lockmgr_printinfo(&vp->v_lock); printf("\n"); return (0); } -- cgit v1.1