svn commit: r341220 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Thu Nov 29 09:04:11 UTC 2018


Author: mjg
Date: Thu Nov 29 09:04:10 2018
New Revision: 341220
URL: https://svnweb.freebsd.org/changeset/base/341220

Log:
  vfs: drop spurious memcpy in stat
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Thu Nov 29 08:53:39 2018	(r341219)
+++ head/sys/kern/vfs_syscalls.c	Thu Nov 29 09:04:10 2018	(r341220)
@@ -2277,7 +2277,6 @@ kern_statat(struct thread *td, int flag, int fd, const
     void (*hook)(struct vnode *vp, struct stat *sbp))
 {
 	struct nameidata nd;
-	struct stat sb;
 	int error;
 
 	if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH)) != 0)
@@ -2290,13 +2289,13 @@ kern_statat(struct thread *td, int flag, int fd, const
 
 	if ((error = namei(&nd)) != 0)
 		return (error);
-	error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td);
+	error = vn_stat(nd.ni_vp, sbp, td->td_ucred, NOCRED, td);
 	if (error == 0) {
-		SDT_PROBE2(vfs, , stat, mode, path, sb.st_mode);
-		if (S_ISREG(sb.st_mode))
+		SDT_PROBE2(vfs, , stat, mode, path, sbp->st_mode);
+		if (S_ISREG(sbp->st_mode))
 			SDT_PROBE2(vfs, , stat, reg, path, pathseg);
 		if (__predict_false(hook != NULL))
-			hook(nd.ni_vp, &sb);
+			hook(nd.ni_vp, sbp);
 	}
 	NDFREE(&nd, NDF_ONLY_PNBUF);
 	vput(nd.ni_vp);
@@ -2308,10 +2307,9 @@ kern_statat(struct thread *td, int flag, int fd, const
 	sb.st_ctim_ext = 0;
 	sb.st_btim_ext = 0;
 #endif
-	*sbp = sb;
 #ifdef KTRACE
 	if (KTRPOINT(td, KTR_STRUCT))
-		ktrstat(&sb);
+		ktrstat(sbp);
 #endif
 	return (0);
 }


More information about the svn-src-head mailing list