Subject: Re: Redoing file system suspension API (update)
To: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 06/29/2006 08:56:43
On Jun 29, 2006, at 3:08 AM, Juergen Hannken-Illjes wrote:

> - We add a transaction lock to "struct mount" behaving like a  
> lockmgr lock
>   but allowing a "already have a shared lock" query.
>
> - Transactions are enclosed in vn_trans_lock/vn_trans_unlock pairs  
> like

Uh, why not make it a normal reader-writer lock and always pair a  
release with an acquire?  That way you can do away with the "1 of the  
read already owns a shared lock".

I think users of the API will go insane with code confusion if they  
have to handle the "already has" case :-)

>
>   if ((s = vn_trans_lock(mp, V_WAIT)) < 0)
> 	return s;
>
>   <run the operation>
>
>   if (s)
> 	vn_trans_unlock(mp);
>
>   where vn_trans_lock() returns -1 on error, 0 on success and 1 if  
> the thread
>   already owns a shared lock.
>
> - We add vfs operations
>
>   VFS_SUSPEND: takes the exclusive transaction lock and sync to disk .
> 	       this sync-to-disk can ignore the vnode locks.
>
>   VFS_RESUME:  relase the exclusive transaction lock.
>
> -- 
> Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig  
> (Germany)

-- thorpej