Re: [PATCH 0/9 RFC] Make wake_up_{bit,var} less fragile
From: Linus Torvalds
Date: Mon Aug 19 2024 - 17:13:14 EST
On Mon, 19 Aug 2024 at 13:52, NeilBrown <neilb@xxxxxxx> wrote:
>
> You could fit those in a short and two bools which gives you three
> different addresses to pass to wake_up_var().
You don't actually have to even do that.
The address passed to 'wake_up_var()' doesn't actually have to *match*
anything. It's used purely as a cookie.
So you can literally do something like
#define inode_state(X,inode) ((X)+(char *)&(inode)->i_state)
and then just use inode_state(0/1/2,inode) for waiting/waking the
different bits (and the numbers 0/1/2 do not have to bear any relation
to the bit numbers, although you may obviously do that).
Linus