From owner-svn-src-head@freebsd.org Mon Feb 3 17:06:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFA88228C82; Mon, 3 Feb 2020 17:06:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48BDkQ49CHz3Jk5; Mon, 3 Feb 2020 17:06:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A29E403A; Mon, 3 Feb 2020 17:06:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 013H6Mko076861; Mon, 3 Feb 2020 17:06:22 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 013H6LRs076858; Mon, 3 Feb 2020 17:06:21 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202002031706.013H6LRs076858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 3 Feb 2020 17:06:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357451 - head/sys/fs/tmpfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/tmpfs X-SVN-Commit-Revision: 357451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Feb 2020 17:06:22 -0000 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;