Subject: Re: mfs read operations.
To: =?iso-8859-1?Q?P=E5l_Halvorsen?= <paalh@unik.no>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 07/20/2001 07:50:50
On Fri, Jul 20, 2001 at 01:41:45PM +0200, Pål Halvorsen wrote:

 > I'm reading data from a memory file system (mfs), due to bad performance
 > of my single-disk storage system, and when monitoring the
 > operations, it seems like the VOP_STRATEGY in bio_read() is not called.
 > However, getblk() is called. Why?
 > Should VOP_STRATEGY be called (is my counter wrong)?
 > 
 > How does the read operates on a mfs? Is the memory blocks containing
 > data only mapped into the buf structures, e.g., using UVM's page loanout
 > or map entry passing? 

Neither.  The current MFS implementation is somewhat of a hack.

Basically, MFS is really just FFS (seriously, it uses all of the FFS
file system code), but merely provides a different backing store for
that FFS -- instead of a disk, it uses the address space of a process.

When I/O to that backing store is to be done, it queues the buffer, wakes
up the process holding the MFS backing store, which then performs a copyin/
copyout from the process's user address space to the buffer, and biodone's
that buffer.

It was done this way to allow the space used by the file system to be
pageable -- it just gets put in swap space.

There are arguably much better ways to write a memory-based file system.
But as I understand it, MFS was written this way originally for a couple
of reasons:

	- As a way to demonstrate how alternate backing store
	  for FFS worked.

	- It was quick and easy.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>