Commit 46eae2e3 authored by Bart Van Assche's avatar Bart Van Assche Committed by Jens Axboe

block/mq-deadline: Add several comments

Make the code easier to read by adding more comments.
Reviewed-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20210618004456.7280-6-bvanassche@acm.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 556910e3
...@@ -139,6 +139,9 @@ static void dd_request_merged(struct request_queue *q, struct request *req, ...@@ -139,6 +139,9 @@ static void dd_request_merged(struct request_queue *q, struct request *req,
} }
} }
/*
* Callback function that is invoked after @next has been merged into @req.
*/
static void dd_merged_requests(struct request_queue *q, struct request *req, static void dd_merged_requests(struct request_queue *q, struct request *req,
struct request *next) struct request *next)
{ {
...@@ -375,6 +378,8 @@ static struct request *__dd_dispatch_request(struct deadline_data *dd) ...@@ -375,6 +378,8 @@ static struct request *__dd_dispatch_request(struct deadline_data *dd)
} }
/* /*
* Called from blk_mq_run_hw_queue() -> __blk_mq_sched_dispatch_requests().
*
* One confusing aspect here is that we get called for a specific * One confusing aspect here is that we get called for a specific
* hardware queue, but we may return a request that is for a * hardware queue, but we may return a request that is for a
* different hardware queue. This is because mq-deadline has shared * different hardware queue. This is because mq-deadline has shared
...@@ -438,6 +443,10 @@ static int dd_init_queue(struct request_queue *q, struct elevator_type *e) ...@@ -438,6 +443,10 @@ static int dd_init_queue(struct request_queue *q, struct elevator_type *e)
return 0; return 0;
} }
/*
* Try to merge @bio into an existing request. If @bio has been merged into
* an existing request, store the pointer to that request into *@rq.
*/
static int dd_request_merge(struct request_queue *q, struct request **rq, static int dd_request_merge(struct request_queue *q, struct request **rq,
struct bio *bio) struct bio *bio)
{ {
...@@ -461,6 +470,10 @@ static int dd_request_merge(struct request_queue *q, struct request **rq, ...@@ -461,6 +470,10 @@ static int dd_request_merge(struct request_queue *q, struct request **rq,
return ELEVATOR_NO_MERGE; return ELEVATOR_NO_MERGE;
} }
/*
* Attempt to merge a bio into an existing request. This function is called
* before @bio is associated with a request.
*/
static bool dd_bio_merge(struct request_queue *q, struct bio *bio, static bool dd_bio_merge(struct request_queue *q, struct bio *bio,
unsigned int nr_segs) unsigned int nr_segs)
{ {
...@@ -518,6 +531,9 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, ...@@ -518,6 +531,9 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
} }
} }
/*
* Called from blk_mq_sched_insert_request() or blk_mq_sched_insert_requests().
*/
static void dd_insert_requests(struct blk_mq_hw_ctx *hctx, static void dd_insert_requests(struct blk_mq_hw_ctx *hctx,
struct list_head *list, bool at_head) struct list_head *list, bool at_head)
{ {
...@@ -544,6 +560,8 @@ static void dd_prepare_request(struct request *rq) ...@@ -544,6 +560,8 @@ static void dd_prepare_request(struct request *rq)
} }
/* /*
* Callback from inside blk_mq_free_request().
*
* For zoned block devices, write unlock the target zone of * For zoned block devices, write unlock the target zone of
* completed write requests. Do this while holding the zone lock * completed write requests. Do this while holding the zone lock
* spinlock so that the zone is never unlocked while deadline_fifo_request() * spinlock so that the zone is never unlocked while deadline_fifo_request()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment