Subject: Re: Redoing file system suspension API (update)
To: Bill Studenmund <wrstuden@netbsd.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 06/23/2006 10:26:00
--H+4ONPRPur6+Ovig
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Jun 22, 2006 at 05:55:52PM +0200, Juergen Hannken-Illjes wrote:
> On Wed, Jun 21, 2006 at 02:24:53PM -0700, Bill Studenmund wrote:
> > On Wed, Jun 21, 2006 at 01:34:38PM +0200, Juergen Hannken-Illjes wrote:
> > > On Wed, Jun 21, 2006 at 08:02:56PM +0900, YAMAMOTO Takashi wrote:
> [snip]
> > > > well, i think neither syscalls or individual VOPs are appropriate
> > > > for your purpose.  what you need is the intermediate.  ie. a set of=
 VOPs.
> >=20
> > Yeah, this is what I'm thinking we should do.
>=20
> What if we add "critical regions" to vnodes?  This could look like
>=20
>     vn_hold(vp, V_WAIT);
>     VOP_XXX(...);
>     VOP_XXX(...);
>     ...
>     vn_release(vp);
>=20
> or
>=20
>     NDINIT(..., ... | HOLDLEAF, ...);
>     if (namei(...) =3D=3D 0) {
> 	VOP_XXX(nd->ni_vp, ...);
> 	VOP_XXX(nd->ni_vp, ...);
> 	...
> 	vn_release(vp);
>     }
>=20
> vn_hold() would wait until suspension is over and the vnode is not held,
> then set a flag VHOLD and increment a hold counter in vp->v_mount.

This is kinda what we are doing now, and what I think is a good idea.

The name, however, is bad. We already have a "hold" facility on vnodes,=20
which is where writes to backing store keep a vnode in memory even if it's=
=20
not otherwise being actively used. So use different names. :-)

> vfs_suspend() would stop further vn_hold(), wait until the hold counter
> drops to zero, suspend and then allow vn_hold() again.
>=20
> For specfs/fifofs we could
>=20
>     need_hold =3D (vp->v_flags & VHOLD);
>     if (need_hold)
> 	vn_release(vp);
>     ... device operation that may sleep long ...
>     if (need_hold)
> 	vn_hold(vp, V_WAIT);

I don't see why fifofs should get special treatment.

Take care,

Bill

--H+4ONPRPur6+Ovig
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFEnCQoWz+3JHUci9cRAthFAJ48wb2ASLc5daO9IiYEVWJx7wLDZQCfTDtl
1bn4GMzAJ4dEferlxvPXRu8=
=Ogc9
-----END PGP SIGNATURE-----

--H+4ONPRPur6+Ovig--