The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=e64928611b3d157608d4fb3906b7362ab98c4ad1
commit e64928611b3d157608d4fb3906b7362ab98c4ad1 Author: Dag-Erling Smørgrav <[email protected]> AuthorDate: 2025-12-14 23:35:58 +0000 Commit: Dag-Erling Smørgrav <[email protected]> CommitDate: 2025-12-17 22:46:04 +0000 unionfs: Sporadic cleanup Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. --- sys/fs/unionfs/union.h | 5 ++--- sys/fs/unionfs/union_subr.c | 37 ++++++++++++++++++------------------- sys/fs/unionfs/union_vnops.c | 6 +++--- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h index fe5a578ef4dc..7317bfff534c 100644 --- a/sys/fs/unionfs/union.h +++ b/sys/fs/unionfs/union.h @@ -139,9 +139,8 @@ void unionfs_get_node_status(struct unionfs_node *, struct thread *, struct unionfs_node_status **); void unionfs_tryrem_node_status(struct unionfs_node *, struct unionfs_node_status *); -int unionfs_check_rmdir(struct vnode *, struct ucred *, struct thread *td); -int unionfs_copyfile(struct vnode *, int, struct ucred *, - struct thread *); +int unionfs_check_rmdir(struct vnode *, struct ucred *, struct thread *); +int unionfs_copyfile(struct vnode *, int, struct ucred *, struct thread *); int unionfs_copylink(struct vnode *, struct ucred *, struct thread *); void unionfs_create_uppervattr_core(struct unionfs_mount *, struct vattr *, struct vattr *, struct thread *); diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 0774d4fb69be..90be4d6af812 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -84,19 +84,19 @@ static void unionfs_deferred_rele(void *, int); /* * Initialize */ -int +int unionfs_init(struct vfsconf *vfsp) { UNIONFSDEBUG("unionfs_init\n"); /* printed during system boot */ TASK_INIT(&unionfs_deferred_rele_task, 0, unionfs_deferred_rele, NULL); - mtx_init(&unionfs_deferred_rele_lock, "uniondefr", NULL, MTX_DEF); + mtx_init(&unionfs_deferred_rele_lock, "uniondefr", NULL, MTX_DEF); return (0); } /* * Uninitialize */ -int +int unionfs_uninit(struct vfsconf *vfsp) { taskqueue_quiesce(taskqueue_unionfs_rele); @@ -290,7 +290,7 @@ unionfs_nodeget_cleanup(struct vnode *vp, struct unionfs_node *unp) /* * Make a new or get existing unionfs node. - * + * * uppervp and lowervp should be unlocked. Because if new unionfs vnode is * locked, uppervp or lowervp is locked too. In order to prevent dead lock, * you should not lock plurality simultaneously. @@ -709,9 +709,9 @@ unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, /* * relookup - * + * * dvp should be locked on entry and will be locked on return. - * + * * If an error is returned, *vpp will be invalid, otherwise it will hold a * locked, referenced vnode. If *vpp == dvp then remember that only one * LK_EXCLUSIVE lock is held. @@ -756,7 +756,7 @@ unionfs_relookup(struct vnode *dvp, struct vnode **vpp, /* * Update the unionfs_node. - * + * * uvp is new locked upper vnode. unionfs vnode's lock will be exchanged to the * uvp's lock and lower's lock will be unlocked. */ @@ -875,10 +875,10 @@ unionfs_clear_in_progress_flag(struct vnode *vp, unsigned int flag) /* * Create a new shadow dir. - * + * * dvp and vp are unionfs vnodes representing a parent directory and * child file, should be locked on entry, and will be locked on return. - * + * * If no error returned, unp will be updated. */ int @@ -1201,7 +1201,7 @@ unionfs_forward_vop_finish_pair( /* * Create a new whiteout. - * + * * dvp and vp are unionfs vnodes representing a parent directory and * child file, should be locked on entry, and will be locked on return. */ @@ -1259,11 +1259,11 @@ unionfs_mkwhiteout_cleanup: } /* - * Create a new vnode for create a new shadow file. - * + * Create a new regular file on upper. + * * If an error is returned, *vpp will be invalid, otherwise it will hold a * locked, referenced and opened vnode. - * + * * unp is never updated. */ static int @@ -1343,8 +1343,8 @@ unionfs_vn_create_on_upper_cleanup: } /* - * Copy from lvp to uvp. - * + * Copy contents of lvp to uvp. + * * lvp and uvp should be locked and opened on entry and will be locked and * opened on return. */ @@ -1410,13 +1410,12 @@ unionfs_copyfile_core(struct vnode *lvp, struct vnode *uvp, /* * Copy file from lower to upper. - * - * If you need copy of the contents, set 1 to docopy. Otherwise, set 0 to - * docopy. + * + * If docopy is non-zero, copy the contents as well. * * vp is a unionfs vnode that should be locked on entry and will be * locked on return. - * + * * If no error returned, unp will be updated. */ int diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index cefd591a9a0f..63e5cd54ade5 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -1183,7 +1183,7 @@ unionfs_ioctl(struct vop_ioctl_args *ap) KASSERT_UNIONFS_VNODE(ap->a_vp); - vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY); unp = VTOUNIONFS(ap->a_vp); unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); @@ -1210,7 +1210,7 @@ unionfs_poll(struct vop_poll_args *ap) KASSERT_UNIONFS_VNODE(ap->a_vp); - vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY); unp = VTOUNIONFS(ap->a_vp); unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); @@ -3089,7 +3089,7 @@ struct vop_vector unionfs_vnodeops = { .vop_add_writecount = unionfs_add_writecount, .vop_vput_pair = unionfs_vput_pair, .vop_set_text = unionfs_set_text, - .vop_unset_text = unionfs_unset_text, + .vop_unset_text = unionfs_unset_text, .vop_unp_bind = unionfs_unp_bind, .vop_unp_connect = unionfs_unp_connect, .vop_unp_detach = unionfs_unp_detach,
