Subject: Re: Proposal: File system suspension - prerequisite for snapshots
To: Bill Studenmund <wrstuden@netbsd.org>
From: Stephan Uphoff <ups@stups.com>
List: tech-kern
Date: 08/15/2003 14:04:08
Bill Studenmund wrote:
> On Wed, 13 Aug 2003, Stephan Uphoff wrote:
> 
> > Wouldn't this be the ideal time to convert the VFS layer to file system
> > internal locking ;-) ?
> 
> Uhm, why?

To improve locking granularity for more concurrency - especially for directory 
operations.
Since fine grained locking requires file system specific knowledge I believe
that locking should be file system internal.

Why block a thread from looking up file "foo" in a directory just because 
another thread is currently
creating file "bar" in the same directory ?

>
> > However I think that it is possible even with the current VFS locking
> > style to to put the suspend functionality inside a file system (gating
> > below the VFS_ level).
> 
> I think I prefer the explicit calls. If we stall all locks, then ALL file
> system access (not just writes) will stop. Yes, I realize that atime
> updating can be a "write", but there are lots of other places where we
> will want to still be able to read from a filesystem while we're
> snapshotting. Consider taking a snapshot of the file system that contains
> the snapshot program, for instance. :-)

I am not sure that we are thinking about the same thing.
For me snapshots are file system internal operations that snap a point in time 
picture
of the state of the filesystem. This snapshots are later exported
(as a read only file system,directory trees ..) to the OS.

Freezing out external access just makes it easier for the filesystem to
take a sharp picture.

Not sure where the snapshot program comes in except as a user interface
to trigger the actual snapshot.

> 
> From having worked with layered file systems, life is much easier if we do
> the locking outside of the VOP calls.

Who wants easy ? - Think of it as job security ;-)
I agree stacking is a little bit harder but still doable.
( As far as I know fist (File System Translator) comes with a Solaris 
template)
It is also easier to write a  snapshot layer file system.

-----

On second thought I don't even know why a file system would need to make sure
that no thread is holding a vnode lock.

I really don't see the need to stop read but not write operations.

And I fail to see why a vfs_write_suspend API is a  prerequisite for file 
system snapshots.

A vfs_suspend API would however be nice to have for Laptop suspension.
( Especially for network file systems )

 
Stephan