git: 89fd61d955ad - main - Merge ufs_fhtovp() into ffs_inotovp().

Konstantin Belousov kib at FreeBSD.org
Fri Feb 12 01:07:11 UTC 2021


The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=89fd61d955ada4fdb20030253206201bc279cdf0

commit 89fd61d955ada4fdb20030253206201bc279cdf0
Author:     Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-01-28 12:20:48 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-02-12 01:02:20 +0000

    Merge ufs_fhtovp() into ffs_inotovp().
    
    The function alone was not used for anything but ffs_fstovp() for long time.
    
    Suggested by:   mckusick
    Reviewed by:    chs, mckusick
    Tested by:      pho
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
---
 sys/ufs/ffs/ffs_vfsops.c | 21 +++++++++++++++++----
 sys/ufs/ufs/ufs_extern.h |  1 -
 sys/ufs/ufs/ufs_vfsops.c | 25 -------------------------
 3 files changed, 17 insertions(+), 30 deletions(-)

diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 596e2f4b4b5f..540dd02c9631 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -2170,6 +2170,7 @@ ffs_inotovp(mp, ino, gen, lflags, vpp, ffs_flags)
 {
 	struct ufsmount *ump;
 	struct vnode *nvp;
+	struct inode *ip;
 	struct fs *fs;
 	struct cg *cgp;
 	struct buf *bp;
@@ -2178,6 +2179,8 @@ ffs_inotovp(mp, ino, gen, lflags, vpp, ffs_flags)
 
 	ump = VFSTOUFS(mp);
 	fs = ump->um_fs;
+	*vpp = NULL;
+
 	if (ino < UFS_ROOTINO || ino >= fs->fs_ncg * fs->fs_ipg)
 		return (ESTALE);
 
@@ -2198,10 +2201,20 @@ ffs_inotovp(mp, ino, gen, lflags, vpp, ffs_flags)
 	}
 
 	error = ffs_vgetf(mp, ino, lflags, &nvp, ffs_flags);
-	if (error == 0)
-		error = ufs_fhtovp(mp, nvp, gen);
-	*vpp = error == 0 ? nvp : NULLVP;
-	return (error);
+	if (error != 0)
+		return (error);
+
+	ip = VTOI(nvp);
+	if (ip->i_mode == 0 || ip->i_gen != gen || ip->i_effnlink <= 0) {
+		if (ip->i_mode == 0)
+			vgone(nvp);
+		vput(nvp);
+		return (ESTALE);
+	}
+
+	vnode_create_vobject(nvp, DIP(ip, i_size), curthread);
+	*vpp = nvp;
+	return (0);
 }
 
 /*
diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h
index ab26750455e8..1697f2c0ba61 100644
--- a/sys/ufs/ufs/ufs_extern.h
+++ b/sys/ufs/ufs/ufs_extern.h
@@ -59,7 +59,6 @@ int	 ufs_bmap(struct vop_bmap_args *);
 int	 ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *,
 	    struct buf *, int *, int *);
 int	 ufs_bmap_seekdata(struct vnode *, off_t *);
-int	 ufs_fhtovp(struct mount *, struct vnode *, u_int64_t);
 int	 ufs_checkpath(ino_t, ino_t, struct inode *, struct ucred *, ino_t *);
 void	 ufs_dirbad(struct inode *, doff_t, char *);
 int	 ufs_dirbadentry(struct vnode *, struct direct *, int);
diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c
index 1a63e92b3e2c..0f45baed634f 100644
--- a/sys/ufs/ufs/ufs_vfsops.c
+++ b/sys/ufs/ufs/ufs_vfsops.c
@@ -214,28 +214,3 @@ ufs_uninit(vfsp)
 #endif
 	return (0);
 }
-
-/*
- * This is the generic part of fhtovp called after the underlying
- * filesystem has validated the file handle.
- *
- * Call the VFS_CHECKEXP beforehand to verify access.
- */
-int
-ufs_fhtovp(mp, nvp, gen)
-	struct mount *mp;
-	struct vnode *nvp;
-	u_int64_t gen;
-{
-	struct inode *ip;
-
-	ip = VTOI(nvp);
-	if (ip->i_mode == 0 || ip->i_gen != gen || ip->i_effnlink <= 0) {
-		if (ip->i_mode == 0)
-			vgone(nvp);
-		vput(nvp);
-		return (ESTALE);
-	}
-	vnode_create_vobject(nvp, DIP(ip, i_size), curthread);
-	return (0);
-}


More information about the dev-commits-src-all mailing list