Skip to content
  • Vladimir Sementsov-Ogievskiy's avatar
    c85feafa
    blockdev: use state.bitmap in block-dirty-bitmap-add action · c85feafa
    Vladimir Sementsov-Ogievskiy authored
    
    
    Other bitmap related actions use the .bitmap pointer in .abort action,
    let's do same here:
    
    1. It helps further refactoring, as bitmap-add is the only bitmap
       action that uses state.action in .abort
    
    2. It must be safe: transaction actions rely on the fact that on
       .abort() the state is the same as at the end of .prepare(), so that
       in .abort() we could precisely rollback the changes done by
       .prepare().
       The only way to remove the bitmap during transaction should be
       block-dirty-bitmap-remove action, but it postpones actual removal to
       .commit(), so we are OK on any rollback path. (Note also that
       bitmap-remove is the only bitmap action that has .commit() phase,
       except for simple g_free the state on .clean())
    
    3. Again, other bitmap actions behave this way: keep the bitmap pointer
       during the transaction.
    
    Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
    Message-Id: <20230510150624.310640-6-vsementsov@yandex-team.ru>
    [kwolf: Also remove the now unused BlockDirtyBitmapState.prepared]
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    c85feafa
    blockdev: use state.bitmap in block-dirty-bitmap-add action
    Vladimir Sementsov-Ogievskiy authored
    
    
    Other bitmap related actions use the .bitmap pointer in .abort action,
    let's do same here:
    
    1. It helps further refactoring, as bitmap-add is the only bitmap
       action that uses state.action in .abort
    
    2. It must be safe: transaction actions rely on the fact that on
       .abort() the state is the same as at the end of .prepare(), so that
       in .abort() we could precisely rollback the changes done by
       .prepare().
       The only way to remove the bitmap during transaction should be
       block-dirty-bitmap-remove action, but it postpones actual removal to
       .commit(), so we are OK on any rollback path. (Note also that
       bitmap-remove is the only bitmap action that has .commit() phase,
       except for simple g_free the state on .clean())
    
    3. Again, other bitmap actions behave this way: keep the bitmap pointer
       during the transaction.
    
    Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
    Message-Id: <20230510150624.310640-6-vsementsov@yandex-team.ru>
    [kwolf: Also remove the now unused BlockDirtyBitmapState.prepared]
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading