Hi all,
I'm pleased to announce that tmpfs, an (efficient) memory file-system,
has been added to NetBSD's main source tree. This project was
developed as part of Google's Summer of Code 2005 program.
I must thank them for the encouragement they gave me in working on
this.
For the curious ones: yes, we already had MFS, but it's a "hack". MFS
is an implementation of the on-disk FFS file-system over memory
pages. It is not "memory-friendly" because it arranges data as if it
was using a disk. Furthermore, it never releases memory pages,
which makes it unusable in several scenarios. OTOH, tmpfs uses
data structures that can easily exist in memory and works closely with
UVM to handle many things transparently (basically, regular files).
The file-system can be considered functionally complete, although it
still has some problems. The main issues at this moment are that it
uses wired (non-pageable) kernel memory to store file meta-data and
that NFS support is broken. It is also not specially efficient, but the
work done in the last few days has improved this area a lot.
What I have done is:
- Added the file-system's code in src/sys/fs/tmpfs.
This is not built by default. To enable, just add:
file-system TMPFS
in your kernel configuration file. If you use a standard configuration,
there should be a commented-out entry like the one shown above,
ready to be uncommented.
- Added the mount_tmpfs(8) utility. This is built by default to ease
installation. (E.g., many people rebuild their kernels but do not want
to build the base system.)
- Added a regression test suite in src/sys/regress/sys/fs/tmpfs.
I encourage you to run it just after enabling tmpfs in your kernel and
before attempting to use tmpfs. Its usage:
cd src/regress/sys/fs/tmpfs
make regress TEST_ARGS=3D"-ujmmv -v2"
Note the arguments: -u specifies a regular user under which to run
some parts of the tests. If this flag is not given, some checks will
be skipped. -v specifies the verbosity of the tests; 2 is the highest
level and is recommended in case you want to know exactly what
failed (if something fails, of course); 1 shows just the test names and
0 shows nothing. 1 is the default.
At last, if you are interested in tmpfs internals, go and read the
tmpfs(9) manual page. It also has a list of known bugs and issues
that must be fixed.
Enjoy!
--=20
Julio M. Merino Vidal <jmmv84@gmail.com>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/