Skip to content

Commit 12f5b93

Browse files
Keith Buschaxboe
authored andcommitted
blk-mq: Remove generation seqeunce
This patch simplifies the timeout handling by relying on the request reference counting to ensure the iterator is operating on an inflight and truly timed out request. Since the reference counting prevents the tag from being reallocated, the block layer no longer needs to prevent drivers from completing their requests while the timeout handler is operating on it: a driver completing a request is allowed to proceed to the next state without additional syncronization with the block layer. This also removes any need for generation sequence numbers since the request lifetime is prevented from being reallocated as a new sequence while timeout handling is operating on it. To enables this a refcount is added to struct request so that request users can be sure they're operating on the same request without it changing while they're processing it. The request's tag won't be released for reuse until both the timeout handler and the completion are done with it. Signed-off-by: Keith Busch <[email protected]> [hch: slight cleanups, added back submission side hctx lock, use cmpxchg for completions] Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent ad103e7 commit 12f5b93

File tree

6 files changed

+89
-254
lines changed

6 files changed

+89
-254
lines changed

block/blk-core.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,6 @@ void blk_rq_init(struct request_queue *q, struct request *rq)
198198
rq->internal_tag = -1;
199199
rq->start_time_ns = ktime_get_ns();
200200
rq->part = NULL;
201-
seqcount_init(&rq->gstate_seq);
202-
u64_stats_init(&rq->aborted_gstate_sync);
203-
/*
204-
* See comment of blk_mq_init_request
205-
*/
206-
WRITE_ONCE(rq->gstate, MQ_RQ_GEN_INC);
207201
}
208202
EXPORT_SYMBOL(blk_rq_init);
209203

block/blk-mq-debugfs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ static const char *const rqf_name[] = {
344344
RQF_NAME(STATS),
345345
RQF_NAME(SPECIAL_PAYLOAD),
346346
RQF_NAME(ZONE_WRITE_LOCKED),
347-
RQF_NAME(MQ_TIMEOUT_EXPIRED),
348347
RQF_NAME(MQ_POLL_SLEPT),
349348
};
350349
#undef RQF_NAME

0 commit comments

Comments
 (0)