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.
This commit is contained in:
Mateusz Guzik 2020-02-03 17:06:21 +00:00
parent af84329100
commit 2abdae33b1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357451
3 changed files with 21 additions and 9 deletions

View File

@ -450,12 +450,17 @@ void tmpfs_itimes(struct vnode *, const struct timespec *,
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_ */

View File

@ -1889,13 +1889,6 @@ tmpfs_itimes(struct vnode *vp, const struct timespec *acc,
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)
{

View File

@ -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;