Skip to content

Commit

Permalink
blk-mq: Allow requests to never expire
Browse files Browse the repository at this point in the history
Some types of requests may be started that are not gauranteed to ever
complete. This adds a request flag that a driver can use so mark the
request as such.

Signed-off-by: Keith Busch <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Keith Busch authored and axboe committed Jan 8, 2015
1 parent 1885b24 commit 5b3f25f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,14 +619,16 @@ void blk_mq_rq_timed_out(struct request *req, bool reserved)
break;
}
}

static void blk_mq_check_expired(struct blk_mq_hw_ctx *hctx,
struct request *rq, void *priv, bool reserved)
{
struct blk_mq_timeout_data *data = priv;

if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags))
return;
if (rq->cmd_flags & REQ_NO_TIMEOUT)
return;

if (time_after_eq(jiffies, rq->deadline)) {
if (!blk_mark_rq_complete(rq))
Expand Down
3 changes: 3 additions & 0 deletions block/blk-timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ void blk_add_timer(struct request *req)
struct request_queue *q = req->q;
unsigned long expiry;

if (req->cmd_flags & REQ_NO_TIMEOUT)
return;

/* blk-mq has its own handler, so we don't need ->rq_timed_out_fn */
if (!q->mq_ops && !q->rq_timed_out_fn)
return;
Expand Down
2 changes: 2 additions & 0 deletions include/linux/blk_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ enum rq_flag_bits {
__REQ_PM, /* runtime pm request */
__REQ_HASHED, /* on IO scheduler merge hash */
__REQ_MQ_INFLIGHT, /* track inflight for MQ */
__REQ_NO_TIMEOUT, /* requests may never expire */
__REQ_NR_BITS, /* stops here */
};

Expand Down Expand Up @@ -243,5 +244,6 @@ enum rq_flag_bits {
#define REQ_PM (1ULL << __REQ_PM)
#define REQ_HASHED (1ULL << __REQ_HASHED)
#define REQ_MQ_INFLIGHT (1ULL << __REQ_MQ_INFLIGHT)
#define REQ_NO_TIMEOUT (1ULL << __REQ_NO_TIMEOUT)

#endif /* __LINUX_BLK_TYPES_H */

0 comments on commit 5b3f25f

Please sign in to comment.