ublk: close queue based on queue's io info
Every queue should be closed based on only its own I/O information, not the whole device. Remove function ublk_is_ready_to_stop(). Change-Id: Iec5a260f68d6f84c0af4c8e0b5380272049b1f5d Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16416 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
parent
2f8a723edf
commit
cde0c555ab
@ -646,27 +646,6 @@ ublk_dev_list_unregister(struct spdk_ublk_dev *ublk)
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool
|
||||
ublk_is_ready_to_stop(struct spdk_ublk_dev *ublk)
|
||||
{
|
||||
/*
|
||||
* Stop action should be called only after all ublk_io are completed.
|
||||
*/
|
||||
bool ready_to_stop = true;
|
||||
struct ublk_queue *q;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < ublk->num_queues; i++) {
|
||||
q = &ublk->queues[i];
|
||||
if (!TAILQ_EMPTY(&q->inflight_io_list) || !TAILQ_EMPTY(&q->completed_io_list) || q->cmd_inflight) {
|
||||
ready_to_stop = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ready_to_stop;
|
||||
}
|
||||
|
||||
static void
|
||||
ublk_close_dev_done(void *arg)
|
||||
{
|
||||
@ -763,15 +742,18 @@ ublk_try_close_dev(void *arg)
|
||||
}
|
||||
|
||||
static void
|
||||
ublk_try_close_queue(void *arg)
|
||||
ublk_try_close_queue(struct ublk_queue *q)
|
||||
{
|
||||
struct ublk_queue *q = arg;
|
||||
struct spdk_ublk_dev *ublk = q->dev;
|
||||
|
||||
if (!ublk_is_ready_to_stop(ublk)) {
|
||||
/* Close queue until no I/O is submitted to bdev in flight,
|
||||
* no I/O is waiting to commit result, and all I/Os are aborted back.
|
||||
*/
|
||||
if (!TAILQ_EMPTY(&q->inflight_io_list) || !TAILQ_EMPTY(&q->completed_io_list) || q->cmd_inflight) {
|
||||
/* wait for next retry */
|
||||
return;
|
||||
}
|
||||
|
||||
TAILQ_REMOVE(&q->thread_ctx->queue_list, q, tailq);
|
||||
spdk_put_io_channel(ublk->ch[q->q_id]);
|
||||
ublk->ch[q->q_id] = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user