main: Refactor FlushMappedBufferRange.