Displaying 5 results from an estimated 5 matches for "_next_state".
Did you mean:
next_state
2019 Jun 05
2
Re: [PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
On Wed, Jun 05, 2019 at 12:15:37PM +0100, Richard W.M. Jones wrote:
> -#define set_state(h,next_state) ((h)->state) = (next_state)
> +#define set_next_state(h,_next_state) ((h)->next_state) = (_next_state)
> +#define get_next_state(h) ((h)->next_state)
> #define get_state(h) ((h)->state)
So I wonder if it's better to rename get_state as get_last_state or
get_visible_state? And/or rename get_next_state/set_next_state to
get_state/s...
2019 Jun 05
1
Re: [PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
On 6/5/19 8:03 AM, Richard W.M. Jones wrote:
> On Wed, Jun 05, 2019 at 01:35:32PM +0100, Richard W.M. Jones wrote:
>> On Wed, Jun 05, 2019 at 12:15:37PM +0100, Richard W.M. Jones wrote:
>>> -#define set_state(h,next_state) ((h)->state) = (next_state)
>>> +#define set_next_state(h,_next_state) ((h)->next_state) = (_next_state)
>>> +#define get_next_state(h) ((h)->next_state)
>>> #define get_state(h) ((h)->state)
>>
>> So I wonder if it's better to rename get_state as get_last_state or
>> get_visible_state?
>
> Or eve...
2019 Jun 05
0
Re: [PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
On Wed, Jun 05, 2019 at 01:35:32PM +0100, Richard W.M. Jones wrote:
> On Wed, Jun 05, 2019 at 12:15:37PM +0100, Richard W.M. Jones wrote:
> > -#define set_state(h,next_state) ((h)->state) = (next_state)
> > +#define set_next_state(h,_next_state) ((h)->next_state) = (_next_state)
> > +#define get_next_state(h) ((h)->next_state)
> > #define get_state(h) ((h)->state)
>
> So I wonder if it's better to rename get_state as get_last_state or
> get_visible_state?
Or even get_public_state?
> A...
2019 Jun 05
0
[PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
Split h->state into:
- h->state = the state on entry to the locked region
- h->next_state = the current state and what the "publicly visible"
state will become when we leave the locked region
Some calls to get_state become calls to get_next_state depending on
which of these they are trying to read. Calls to set_state become
set_next_state because that is what gets updated.
When we leave the locked region we update h->state.
The purpose of this patch is to make it easier to reason about the
state in lockless code.
---
generator/genera...
2019 Jun 05
9
[PATCH libnbd 0/4] lib: Atomically update h->state.
I need to think about this patch series a bit more, but it
does at least pass the tests.
Rich.