Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Nov 2018 09:04:10 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r341220 - head/sys/kern
Message-ID:  <201811290904.wAT94APb097635@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811290904.wAT94APb097635>