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_vfsops.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_vfsops.c')
-rw-r--r-- | sys/fs/unionfs/union_vfsops.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index ea09895..3125f59 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -123,6 +123,7 @@ unionfs_domount(struct mount *mp, struct thread *td) u_short udir; u_short ufile; unionfs_copymode copymode; + unionfs_whitemode whitemode; struct componentname fakecn; struct nameidata nd, *ndp; struct vattr va; @@ -136,6 +137,7 @@ unionfs_domount(struct mount *mp, struct thread *td) udir = 0; ufile = 0; copymode = UNIONFS_TRANSPARENT; /* default */ + whitemode = UNIONFS_WHITE_ALWAYS; ndp = &nd; if (mp->mnt_flag & MNT_ROOTFS) { @@ -237,6 +239,20 @@ unionfs_domount(struct mount *mp, struct thread *td) return (EINVAL); } } + if (vfs_getopt(mp->mnt_optnew, "whiteout", (void **)&tmp, + NULL) == 0) { + if (tmp == NULL) { + vfs_mount_error(mp, "Invalid whiteout mode"); + return (EINVAL); + } else if (strcasecmp(tmp, "always") == 0) + whitemode = UNIONFS_WHITE_ALWAYS; + else if (strcasecmp(tmp, "whenneeded") == 0) + whitemode = UNIONFS_WHITE_WHENNEEDED; + else { + vfs_mount_error(mp, "Invalid whiteout mode"); + return (EINVAL); + } + } } /* If copymode is UNIONFS_TRADITIONAL, uid/gid is mounted user. */ if (copymode == UNIONFS_TRADITIONAL) { @@ -286,6 +302,7 @@ unionfs_domount(struct mount *mp, struct thread *td) ump->um_udir = udir; ump->um_ufile = ufile; ump->um_copymode = copymode; + ump->um_whitemode = whitemode; MNT_ILOCK(mp); if ((lowerrootvp->v_mount->mnt_kern_flag & MNTK_MPSAFE) && |