Summary:
Free up 3B in the WT_REF structure.
The WT_REF.state field is a uint32_t, and only needs to be 1B.
The WT_REF_READING state is confusing, leading to problems when locking code looks like this:
for (;; __wt_yield()) { previous_state = ref->state; if (previous_state != WT_REF_LOCKED && WT_REF_CAS_STATE(session, ref, previous_state, WT_REF_LOCKED)) break; }
instead of like this:
for (;; __wt_yield()) { previous_state = ref->state; if (previous_state != WT_REF_LOCKED && previous_state != WT_REF_READING && WT_REF_CAS_STATE(session, ref, previous_state, WT_REF_LOCKED)) break; }
We should change WT_REF.state into a uint8_t, and change WT_REF_READING into a flag in the WT_REF instead of a separate state.
Here's the diff:
https://github.com/wiredtiger/wiredtiger/pull/5207/commits/05cb651dda123656199dd63c21d09d0c9d76a84a
from a declined pull request for WT-5489.