Skip to content
  • Vladimir Sementsov-Ogievskiy's avatar
    bed95234
    block-copy: refactor copy_range handling · bed95234
    Vladimir Sementsov-Ogievskiy authored
    
    
    Currently we update s->use_copy_range and s->copy_size in
    block_copy_do_copy().
    
    It's not very good:
    
    1. block_copy_do_copy() is intended to be a simple function, that wraps
    bdrv_co_<io> functions for need of block copy. That's why we don't pass
    BlockCopyTask into it. So, block_copy_do_copy() is bad place for
    manipulation with generic state of block-copy process
    
    2. We are going to make block-copy thread-safe. So, it's good to move
    manipulation with state of block-copy to the places where we'll need
    critical sections anyway, to not introduce extra synchronization
    primitives in block_copy_do_copy().
    
    Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    Message-Id: <20210528141628.44287-3-vsementsov@virtuozzo.com>
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    bed95234
    block-copy: refactor copy_range handling
    Vladimir Sementsov-Ogievskiy authored
    
    
    Currently we update s->use_copy_range and s->copy_size in
    block_copy_do_copy().
    
    It's not very good:
    
    1. block_copy_do_copy() is intended to be a simple function, that wraps
    bdrv_co_<io> functions for need of block copy. That's why we don't pass
    BlockCopyTask into it. So, block_copy_do_copy() is bad place for
    manipulation with generic state of block-copy process
    
    2. We are going to make block-copy thread-safe. So, it's good to move
    manipulation with state of block-copy to the places where we'll need
    critical sections anyway, to not introduce extra synchronization
    primitives in block_copy_do_copy().
    
    Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    Message-Id: <20210528141628.44287-3-vsementsov@virtuozzo.com>
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading