backup: Extract dirty bitmap handling as a separate function