Loading block/blk-mq.c +37 −25 Original line number Diff line number Diff line Loading @@ -498,25 +498,16 @@ __blk_mq_alloc_requests_batch(struct blk_mq_alloc_data *data) return rq_list_pop(data->cached_rqs); } static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) static void blk_mq_limit_depth(struct blk_mq_alloc_data *data) { struct request_queue *q = data->q; u64 alloc_time_ns = 0; struct request *rq; unsigned int tag; /* alloc_time includes depth and tag waits */ if (blk_queue_rq_alloc_time(q)) alloc_time_ns = blk_time_get_ns(); if (data->cmd_flags & REQ_NOWAIT) data->flags |= BLK_MQ_REQ_NOWAIT; struct elevator_mq_ops *ops; retry: data->ctx = blk_mq_get_ctx(q); data->hctx = blk_mq_map_queue(data->cmd_flags, data->ctx); /* If no I/O scheduler has been configured, don't limit requests */ if (!data->q->elevator) { blk_mq_tag_busy(data->hctx); return; } if (q->elevator) { /* * All requests use scheduler tags when an I/O scheduler is * enabled for the queue. Loading @@ -525,22 +516,43 @@ static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) /* * Flush/passthrough requests are special and go directly to the * dispatch list. * dispatch list, they are not subject to the async_depth limit. */ if ((data->cmd_flags & REQ_OP_MASK) != REQ_OP_FLUSH && !blk_op_is_passthrough(data->cmd_flags)) { struct elevator_mq_ops *ops = &q->elevator->type->ops; if ((data->cmd_flags & REQ_OP_MASK) == REQ_OP_FLUSH || blk_op_is_passthrough(data->cmd_flags)) return; WARN_ON_ONCE(data->flags & BLK_MQ_REQ_RESERVED); data->rq_flags |= RQF_USE_SCHED; /* * By default, sync requests have no limit, and async requests are * limited to async_depth. */ ops = &data->q->elevator->type->ops; if (ops->limit_depth) ops->limit_depth(data->cmd_flags, data); } } else { blk_mq_tag_busy(data->hctx); } static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) { struct request_queue *q = data->q; u64 alloc_time_ns = 0; struct request *rq; unsigned int tag; /* alloc_time includes depth and tag waits */ if (blk_queue_rq_alloc_time(q)) alloc_time_ns = blk_time_get_ns(); if (data->cmd_flags & REQ_NOWAIT) data->flags |= BLK_MQ_REQ_NOWAIT; retry: data->ctx = blk_mq_get_ctx(q); data->hctx = blk_mq_map_queue(data->cmd_flags, data->ctx); blk_mq_limit_depth(data); if (data->flags & BLK_MQ_REQ_RESERVED) data->rq_flags |= RQF_RESV; Loading Loading
block/blk-mq.c +37 −25 Original line number Diff line number Diff line Loading @@ -498,25 +498,16 @@ __blk_mq_alloc_requests_batch(struct blk_mq_alloc_data *data) return rq_list_pop(data->cached_rqs); } static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) static void blk_mq_limit_depth(struct blk_mq_alloc_data *data) { struct request_queue *q = data->q; u64 alloc_time_ns = 0; struct request *rq; unsigned int tag; /* alloc_time includes depth and tag waits */ if (blk_queue_rq_alloc_time(q)) alloc_time_ns = blk_time_get_ns(); if (data->cmd_flags & REQ_NOWAIT) data->flags |= BLK_MQ_REQ_NOWAIT; struct elevator_mq_ops *ops; retry: data->ctx = blk_mq_get_ctx(q); data->hctx = blk_mq_map_queue(data->cmd_flags, data->ctx); /* If no I/O scheduler has been configured, don't limit requests */ if (!data->q->elevator) { blk_mq_tag_busy(data->hctx); return; } if (q->elevator) { /* * All requests use scheduler tags when an I/O scheduler is * enabled for the queue. Loading @@ -525,22 +516,43 @@ static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) /* * Flush/passthrough requests are special and go directly to the * dispatch list. * dispatch list, they are not subject to the async_depth limit. */ if ((data->cmd_flags & REQ_OP_MASK) != REQ_OP_FLUSH && !blk_op_is_passthrough(data->cmd_flags)) { struct elevator_mq_ops *ops = &q->elevator->type->ops; if ((data->cmd_flags & REQ_OP_MASK) == REQ_OP_FLUSH || blk_op_is_passthrough(data->cmd_flags)) return; WARN_ON_ONCE(data->flags & BLK_MQ_REQ_RESERVED); data->rq_flags |= RQF_USE_SCHED; /* * By default, sync requests have no limit, and async requests are * limited to async_depth. */ ops = &data->q->elevator->type->ops; if (ops->limit_depth) ops->limit_depth(data->cmd_flags, data); } } else { blk_mq_tag_busy(data->hctx); } static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) { struct request_queue *q = data->q; u64 alloc_time_ns = 0; struct request *rq; unsigned int tag; /* alloc_time includes depth and tag waits */ if (blk_queue_rq_alloc_time(q)) alloc_time_ns = blk_time_get_ns(); if (data->cmd_flags & REQ_NOWAIT) data->flags |= BLK_MQ_REQ_NOWAIT; retry: data->ctx = blk_mq_get_ctx(q); data->hctx = blk_mq_map_queue(data->cmd_flags, data->ctx); blk_mq_limit_depth(data); if (data->flags & BLK_MQ_REQ_RESERVED) data->rq_flags |= RQF_RESV; Loading