• Tejun Heo's avatar
    block: make barrier completion more robust · 8f11b3e9
    Tejun Heo authored
    Barrier completion had the following assumptions.
    
    * start_ordered() couldn't finish the whole sequence properly.  If all
      actions are to be skipped, q->ordseq is set correctly but the actual
      completion was never triggered thus hanging the barrier request.
    
    * Drain completion in elv_complete_request() assumed that there's
      always at least one request in the queue when drain completes.
    
    Both assumptions are true but these assumptions need to be removed to
    improve empty barrier implementation.  This patch makes the following
    changes.
    
    * Make start_ordered() use blk_ordered_complete_seq() to mark skipped
      steps complete and notify __elv_next_request() that it should fetch
      the next request if the whole barrier has completed inside
      start_ordered().
    
    * Make drain completion path in elv_complete_request() check whether
      the queue is empty.  Empty queue also indicates drain completion.
    
    * While at it, convert 0/1 return from blk_do_ordered() to false/true.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
    8f11b3e9
blk-barrier.c 9.45 KB