Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Feb 2020 17:06:21 +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: r357451 - head/sys/fs/tmpfs
Message-ID:  <202002031706.013H6LRs076858@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Mon Feb  3 17:06:21 2020
New Revision: 357451
URL: https://svnweb.freebsd.org/changeset/base/357451

Log:
  tmpfs: inline tmpfs_update
  
  It was generated to be just a jumping off point to tmpfs_itimes.
  
  While here provide a dedicated variant for getattr since we normally don't
  expect to need to the update from that caller.

Modified:
  head/sys/fs/tmpfs/tmpfs.h
  head/sys/fs/tmpfs/tmpfs_subr.c
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs.h
==============================================================================
--- head/sys/fs/tmpfs/tmpfs.h	Mon Feb  3 16:41:40 2020	(r357450)
+++ head/sys/fs/tmpfs/tmpfs.h	Mon Feb  3 17:06:21 2020	(r357451)
@@ -450,13 +450,18 @@ void	tmpfs_itimes(struct vnode *, const struct timespe
 
 void	tmpfs_set_status(struct tmpfs_mount *tm, struct tmpfs_node *node,
 	    int status);
-void	tmpfs_update(struct vnode *);
 int	tmpfs_truncate(struct vnode *, off_t);
 struct tmpfs_dirent *tmpfs_dir_first(struct tmpfs_node *dnode,
 	    struct tmpfs_dir_cursor *dc);
 struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node *dnode,
 	    struct tmpfs_dir_cursor *dc);
+static __inline void
+tmpfs_update(struct vnode *vp)
+{
 
+	tmpfs_itimes(vp, NULL, NULL);
+}
+
 /*
  * Convenience macros to simplify some logical expressions.
  */
@@ -534,6 +539,20 @@ tmpfs_use_nc(struct vnode *vp)
 
 	return (!(VFS_TO_TMPFS(vp->v_mount)->tm_nonc));
 }
+
+static inline void
+tmpfs_update_getattr(struct vnode *vp)
+{
+	struct tmpfs_node *node;
+	int update_flags;
+
+	update_flags = TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED;
+
+	node = VP_TO_TMPFS_NODE(vp);
+	if (__predict_false(node->tn_status & update_flags) != 0)
+		tmpfs_update(vp);
+}
+
 #endif /* _KERNEL */
 
 #endif /* _FS_TMPFS_TMPFS_H_ */

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_subr.c	Mon Feb  3 16:41:40 2020	(r357450)
+++ head/sys/fs/tmpfs/tmpfs_subr.c	Mon Feb  3 17:06:21 2020	(r357451)
@@ -1889,13 +1889,6 @@ tmpfs_itimes(struct vnode *vp, const struct timespec *
 	random_harvest_queue(node, sizeof(*node), RANDOM_FS_ATIME);
 }
 
-void
-tmpfs_update(struct vnode *vp)
-{
-
-	tmpfs_itimes(vp, NULL, NULL);
-}
-
 int
 tmpfs_truncate(struct vnode *vp, off_t length)
 {

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vnops.c	Mon Feb  3 16:41:40 2020	(r357450)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c	Mon Feb  3 17:06:21 2020	(r357451)
@@ -387,7 +387,7 @@ tmpfs_getattr(struct vop_getattr_args *v)
 
 	node = VP_TO_TMPFS_NODE(vp);
 
-	tmpfs_update(vp);
+	tmpfs_update_getattr(vp);
 
 	vap->va_type = vp->v_type;
 	vap->va_mode = node->tn_mode;



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