Bitmap
Bitmaps are data structures used internally by bsr, and are used to track blocks in which resources on both nodes are synchronized or out of sync. This is only relevant when the resource is in disconnected mode.
One bit in the bitmap represents 4KiB data on the disk. If the bit is clean (if it is 0), it means that the block is still synchronized with the other node or is in progress. Or it means that it was not written to the block even after the connection was lost. Conversely, if the bit is set (if 1), it means that the block has been modified and resynchronization is required when the connection is re-established.
When bsr detects write I/O while the connection is disconnected, it stores the bit setting of the bitmap in memory(RAM). Writing to metadata is not done immediately due to the cost of write I/O (low performance). Bitmap contents are reflected to disk only when the corresponding block record has expired from the activity log. And if the resource is stopped (down command) while the network is disconnected, the contents of the bitmap are all written to disk.
When the peer node is restored or the connection to the peer is re-established, bsr collects and checks bitmap information from both nodes to determine the total data set to resynchronize. At the same time, the generation identifiers are checked to determine the direction of synchronization.
The node acting as the source of synchronization sends the requested block to the other node, and the synchronization target node applies the changes to clear the sync bit in the bitmap. If resynchronization is interrupted (such as a network failure) and then resumed, the modifications made during the interruption are added to the resynchronization data set.
Resynchronization can be paused and resumed directly with bsradm's pause-sync / resume-sync command. However, it is not recommended to use this command frequently. Stopping resynchronization for no apparent reason is undesirable because the data on the secondary node remains inconsistent for longer than necessary.