Hi all,
Is there a simplistic way to understand the state transition? I got confused with the oldState, newState and “action”. My understanding is that 1) postWrite only in IDLE state; 2) stop IO when a) there’s no outstanding write (DRAINED), or 2) it's in IDLE; 3) queue up Write requests in any other state and wait until IDLE to drain the write queue. What confuses me is that: 1) why do we need the Notify/Pending_notify/Pending_data/Data state. 2) why do we need to use state.get() to set both oldState and newState? The state transition code should be locked anyway. 3) when will state.boolCompareAndSwap(oldState, newState) ever return false? Thanks, Danny