diff options
author | daichi <daichi@FreeBSD.org> | 2007-10-14 13:55:38 +0000 |
---|---|---|
committer | daichi <daichi@FreeBSD.org> | 2007-10-14 13:55:38 +0000 |
commit | b4e293afdf72162137b2dba22113a5ee64c72c99 (patch) | |
tree | 2c0a8dc097e870c563dc170664ef755488256a67 /sys/fs/unionfs/union_vnops.c | |
parent | 7759a8a0eb0499316da250fbc2b12c0de2134cc7 (diff) | |
download | FreeBSD-src-b4e293afdf72162137b2dba22113a5ee64c72c99.zip FreeBSD-src-b4e293afdf72162137b2dba22113a5ee64c72c99.tar.gz |
Added whiteout behavior option. ``-o whiteout=always'' is default mode
(it is established practice) and ``-o whiteout=whenneeded'' is less
disk-space using mode especially for resource restricted environments
like embedded environments. (Contributed by Ed Schouten. Thanks)
Submitted by: Masanori Ozawa <ozawa@ongs.co.jp> (unionfs developer)
Reviewed by: jeff, kensmith
Approved by: re (kensmith)
MFC after: 1 week
Diffstat (limited to 'sys/fs/unionfs/union_vnops.c')
-rw-r--r-- | sys/fs/unionfs/union_vnops.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 0437fe2..7a0cb60 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -939,6 +939,7 @@ unionfs_remove(struct vop_remove_args *ap) int error; struct unionfs_node *dunp; struct unionfs_node *unp; + struct unionfs_mount *ump; struct vnode *udvp; struct vnode *uvp; struct vnode *lvp; @@ -960,7 +961,9 @@ unionfs_remove(struct vop_remove_args *ap) return (EROFS); if (uvp != NULLVP) { - cnp->cn_flags |= DOWHITEOUT; + ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); + if (ump->um_whitemode == UNIONFS_WHITE_ALWAYS || lvp != NULLVP) + cnp->cn_flags |= DOWHITEOUT; error = VOP_REMOVE(udvp, uvp, cnp); } else if (lvp != NULLVP) error = unionfs_mkwhiteout(udvp, cnp, td, unp->un_path); @@ -1290,6 +1293,7 @@ unionfs_rmdir(struct vop_rmdir_args *ap) int error; struct unionfs_node *dunp; struct unionfs_node *unp; + struct unionfs_mount *ump; struct componentname *cnp; struct thread *td; struct vnode *udvp; @@ -1319,7 +1323,9 @@ unionfs_rmdir(struct vop_rmdir_args *ap) if (error != 0) return (error); } - cnp->cn_flags |= DOWHITEOUT; + ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); + if (ump->um_whitemode == UNIONFS_WHITE_ALWAYS || lvp != NULLVP) + cnp->cn_flags |= DOWHITEOUT; error = VOP_RMDIR(udvp, uvp, cnp); } else if (lvp != NULLVP) |