summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2015-11-29 21:01:02 +0000
committermckusick <mckusick@FreeBSD.org>2015-11-29 21:01:02 +0000
commitcb4ab786a10727b3013ae5be67aadaf4cc10ca31 (patch)
tree28e73ebc7868b1922684e34406848eec29c359b8 /sys/ufs
parentc1dbc31d595184f214e7d03ebf80901cffe0b713 (diff)
downloadFreeBSD-src-cb4ab786a10727b3013ae5be67aadaf4cc10ca31.zip
FreeBSD-src-cb4ab786a10727b3013ae5be67aadaf4cc10ca31.tar.gz
For performance reasons, it is useful to have a single string used as
the name of a filesystem when setting it as the first parameter to the getnewvnode() function. Most filesystems call getnewvnode from just one place so can use a literal string as the first parameter. However, NFS calls getnewvnode from two places, so we create a global constant string that can be used by the two instances. This change also collapses two instances of getnewvnode() in the UFS filesystem to a single call. Reviewed by: kib Tested by: Peter Holm
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index ebd8520..82c22fd 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1670,10 +1670,8 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags)
ip = uma_zalloc(uma_inode, M_WAITOK | M_ZERO);
/* Allocate a new vnode/inode. */
- if (fs->fs_magic == FS_UFS1_MAGIC)
- error = getnewvnode("ufs", mp, &ffs_vnodeops1, &vp);
- else
- error = getnewvnode("ufs", mp, &ffs_vnodeops2, &vp);
+ error = getnewvnode("ufs", mp, fs->fs_magic == FS_UFS1_MAGIC ?
+ &ffs_vnodeops1 : &ffs_vnodeops2, &vp);
if (error) {
*vpp = NULL;
uma_zfree(uma_inode, ip);
OpenPOWER on IntegriCloud