Skip to content
  • Fam Zheng's avatar
    thread-pool: Convert thread_pool_aiocb_info.cancel to cancel_async · 3391f5e5
    Fam Zheng authored
    
    
    The .cancel_async shares the same the first half with .cancel: try to
    steal the request if not submitted yet. In this case set the elem to
    THREAD_DONE status and ret to -ECANCELED, which means
    thread_pool_completion_bh will call the cb with -ECANCELED.
    
    If the request is already submitted, do nothing, as we know the normal
    completion will happen in the future.
    
    Testing code update:
    
    Before, done_cb is only called if the request is already submitted by
    thread pool. Now done_cb is always called, even before it is submitted,
    because we emulate bdrv_aio_cancel with bdrv_aio_cancel_async. So also
    update the test criteria accordingly.
    
    Signed-off-by: default avatarFam Zheng <famz@redhat.com>
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    3391f5e5