buddy: in struct i_wait, separate initiator and allocator owned members

In particular with uint8_t, we risk writes to be non atomic and
overwrite neighboring members
parent 345ae72d
......@@ -295,14 +295,16 @@ enum i_wait_state {
struct i_wait {
unsigned magic;
#define I_WAIT_MAGIC 0x7f6303bc
uint8_t alloced; // how many of n
uint8_t finid;
uint8_t next;
enum i_wait_state state;
VTAILQ_ENTRY(buddy_reqs) list;
pthread_mutex_t wait_mtx;
#define I_WAIT_MAGIC 0x7f6303bc
// owned by initiator
uint8_t finid;
uint8_t next;
pthread_mutex_t wait_mtx;
pthread_cond_t wait_cond;
VTAILQ_ENTRY(buddy_reqs) list;
// updated under lock - KEEP SEPERATE FROM "owned by initiator"
uint8_t alloced; // how many of n
enum i_wait_state state;
};
#define BUDDY_REQS_AUDIT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment