diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-06-20 14:15:47 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-06-20 21:27:14 -0400 |
commit | 7b6078146ccbe9bd165d578586b10ea092ac489e (patch) | |
tree | 757b09a4928cc73e404a3bfd0b0528de444873d4 | |
parent | 332ebbf7f9efb31ffc363b99da548963ee3fd66d (diff) |
blk-mq: Document locking assumptions
Document the locking assumptions in functions that modify
blk_mq_ctx.rq_list to make it easier for humans to verify
this code.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Omar Sandoval <osandov@fb.com>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/blk-mq-sched.c | 2 | ||||
-rw-r--r-- | block/blk-mq.c | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 9f025289da63..191bf82d185e 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c | |||
@@ -150,6 +150,8 @@ static bool blk_mq_attempt_merge(struct request_queue *q, | |||
150 | struct request *rq; | 150 | struct request *rq; |
151 | int checked = 8; | 151 | int checked = 8; |
152 | 152 | ||
153 | lockdep_assert_held(&ctx->lock); | ||
154 | |||
153 | list_for_each_entry_reverse(rq, &ctx->rq_list, queuelist) { | 155 | list_for_each_entry_reverse(rq, &ctx->rq_list, queuelist) { |
154 | bool merged = false; | 156 | bool merged = false; |
155 | 157 | ||
diff --git a/block/blk-mq.c b/block/blk-mq.c index 6268380c680f..1d8050e49a94 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -1317,6 +1317,8 @@ static inline void __blk_mq_insert_req_list(struct blk_mq_hw_ctx *hctx, | |||
1317 | { | 1317 | { |
1318 | struct blk_mq_ctx *ctx = rq->mq_ctx; | 1318 | struct blk_mq_ctx *ctx = rq->mq_ctx; |
1319 | 1319 | ||
1320 | lockdep_assert_held(&ctx->lock); | ||
1321 | |||
1320 | trace_block_rq_insert(hctx->queue, rq); | 1322 | trace_block_rq_insert(hctx->queue, rq); |
1321 | 1323 | ||
1322 | if (at_head) | 1324 | if (at_head) |
@@ -1330,6 +1332,8 @@ void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, | |||
1330 | { | 1332 | { |
1331 | struct blk_mq_ctx *ctx = rq->mq_ctx; | 1333 | struct blk_mq_ctx *ctx = rq->mq_ctx; |
1332 | 1334 | ||
1335 | lockdep_assert_held(&ctx->lock); | ||
1336 | |||
1333 | __blk_mq_insert_req_list(hctx, rq, at_head); | 1337 | __blk_mq_insert_req_list(hctx, rq, at_head); |
1334 | blk_mq_hctx_mark_pending(hctx, ctx); | 1338 | blk_mq_hctx_mark_pending(hctx, ctx); |
1335 | } | 1339 | } |