Teach mdmfs about tmpfs and use tmpfs in rc scripts
Konstantin Belousov
kostikbel at gmail.com
Fri Mar 7 15:19:53 UTC 2014
On Thu, Mar 06, 2014 at 04:26:53PM -0700, Ian Lepore wrote:
> A recent discussion on arm@ about using tmpfs instead of md(4) spurred
> me to do something I've been wanting to do for a while: enhance mdmfs
> so that it can configure tmpfs as well as md+ffs, and update the rc
> scripts to make use the the feature.
>
> Attached are diffs to do this (man page updates not in there yet).
>
> mdmfs recognizes two new values for the md-device argument: tmpfs and
> auto. If you request 'tmpfs' you get it, or it fails if tmpfs is not
> present in the kernel. If you request 'auto' it will use tmpfs if it's
> present in the kernel and the other options don't include multilabel MAC
> (which tmpfs doesn't handle, as near as I can tell). Other options
> which have no meaning with tmpfs (such as setting the number of inodes)
> are silently ignored.
>
> The rc scripts are updated to add a new mfs_type knob, which defaults to
> "auto". This in effect automatically updates folks to use tmpfs instead
> of md as long as it's present and they aren't using the one option that
> forbids it (multilabel MAC).
>
> Thoughts?
>
> -- Ian
>
> Index: sys/fs/tmpfs/tmpfs_vfsops.c
> ===================================================================
> --- sys/fs/tmpfs/tmpfs_vfsops.c (revision 262759)
> +++ sys/fs/tmpfs/tmpfs_vfsops.c (working copy)
> @@ -60,6 +60,8 @@ __FBSDID("$FreeBSD$");
>
> #include <fs/tmpfs/tmpfs.h>
>
> +FEATURE(tmpfs, "Efficient memory file system");
> +
The existing way to check for the presence of the filesystem module
in the kernel is sysctl vfs.conflist or getvfsbyname(3) wrapper around
it. I suspect that the interface is unknown because the information
about fs module presence in kernel is pretty much useless: nmount(2)
syscall auto-loads required fs module if not already present.
That said, the feature for tmpfs is redundand and should not be added.
I do not see adding the ability to issue 'mount -t tmpfs ...' command
to mdmfs(8) as right approach. The helper is already complicated and
its single-purpose functionality of newfs-ing md(4) IMO should be left
as is. If you want to to have /var on tmpfs, why not change rc.d/var ?
It would be much simpler, since the change would be one-liner for
mount_md line.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20140307/1c678631/attachment.sig>
More information about the freebsd-arch
mailing list