vnd(4) is the virtual disk driver found in NetBSD. It provides a disk-like interface to files which allows you to treat them as if they were disks. This is useful, for example, when a file holds a file system image (e.g. the typical ISO-9660 files) and you want to inspect its contents.
Up until now vnd(4) used the vnode’s bmap and strategy operations to
access the backing file. These operate at the block-level and therefore
do not involve any system-wide caches; this is why they were used (see
below). Unfortunately, some file systems (e.g. tmpfs and smbfs) do not
implement these operations so vnd could not work with files stored
inside them.
One of the possible fixes to resolve this problem was to make vnd(4) use
the regular read and write operations; these act on a higher (byte)
level and are so fundamental that must be implemented by all file
systems. The disadvantage is that all data that flows through these two
methods ends up in the buffer cache. (If I understand it correctly, this
is problematic because vnd itself will also push a copy of the same data
into the cache thus ending up with duplicates in there.)
Despite that minor problem, I believe it is better to have vnd(4)
working in all cases even if that involves some performance penalty in
some situations (which can be fixed anyway by implementing the missing
operations later on). So this is what I have done: vnd(4) will now use
read and write for those files stored in file systems where bmap and
strategy are not available and continue to use the latter two if they
are present (as it has always done).
Some more information can be found in the CVS commit and its corresponding bug report.
(Content also available at: gemini://capsule.jmmv.dev/post/2006/11/making-vnd4-work-with-tmpfs.gmi)