Subject: bloated code paths in ufs_lock/unlock
To: None <tech-kern@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 04/14/2007 15:13:52
I've just looked at the current versions of ufs_lock/unlock (in
ufs/usf/ufs_vnops.c), they both contain the following conditional:
if ((vp->v_type == VREG || vp->v_type == VDIR) &&
fstrans_is_owner(mp) &&
fstrans_getstate(mp) == FSTRANS_SUSPENDING) {
Now the first 2 tests are almost always true.
fstrans_is_owner() would be fairly cheap if IMNT_HAS_TRANS were clear on
the mount - but it is always set for ffs, instead it has the loop:
for (fli = lwp_getspecific(lwp_data_key); fli; fli = fli->fli_succ)
if (fli->fli_mount == mp)
break;
fstrans_getstate() calls mount_getspecific(mp, mount_data_key)
I don't suppose either of the latter functions are intended to be
called every time a vnode is locked/unlocked on the off chance that
'file system suspension' is in progess.
David
--
David Laight: david@l8s.co.uk