Subject: Re: p_flag in struct proc: int -> uint64_t
To: Jason Thorpe <thorpej@shagadelic.org>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: tech-kern
Date: 10/10/2006 11:46:25
On Mon, Oct 09, 2006 at 03:45:28PM -0700, Jason Thorpe wrote:
>
> On Oct 9, 2006, at 1:43 AM, Juergen Hannken-Illjes wrote:
>
> >The latter. Call xxx_set() and xxx_get() with locks held.
>
> For setspecific, I could add a setspecific_nowait, but I'm concerned
> about what the failure mode is supposed to be if it were to fail...
> would you unwind your state, and try to set the data some other way,
> or would you fail the operation in some fashion?
I will fail like this:
int
fstrans_start(struct mount *mp, int flags)
{
int error;
struct fstrans_state *fts;
if ((fts = lwp_getspecific(curlwp, fstrans_state_key)) == NULL) {
if ((flags & FSTRANS_NOWAIT) != 0) {
if ((fts = pool_get(&fstrans_spl, PR_NOWAIT)) == NULL)
return EWOULDBLOCK;
if ((error = lwp_setspecific_nowait(curlwp,
fstrans_state_key, fts)) != 0) {
pool_put(&fstrans_spl, fts);
return error;
}
} else {
fts = pool_get(&fstrans_spl, 0);
lwp_setspecific(curlwp, fstrans_state_key, fts);
}
init_state(fts);
}
...
}
--
Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)