cbufferext4journaling

What is BJ_Shadow in JBD2 context?


I am studying the jbd2 source code, and I could not understand what the BJ_Shadow flag means for a given buffer_head.

Is BJ_Shadow a copy of the given buffer_head or what?


Solution

  • When a buffer is in BJ_Shadow state, it means that there is a copy-out of this buffer being written to the disk.

    So, basically when the transaction is committing, the buffer head (BH) going to be written is in the BJ_Metadata state, and the committing thread will make a copy of this BH to be used for the IO submission. After the copy is made, the transaction changes the state of the BH to BJ_Shadow, and finally the last state after IO completion is the BJ_Forget state.