mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
scsi: blk-mq: Add callbacks for storing & retrieving budget token
Since SCSI is the only driver which requires dispatch budget move the token from struct request to struct scsi_cmnd. Link: https://lore.kernel.org/r/20210122023317.687987-8-ming.lei@redhat.com Cc: Omar Sandoval <osandov@fb.com> Cc: Kashyap Desai <kashyap.desai@broadcom.com> Cc: Sumanesh Samanta <sumanesh.samanta@broadcom.com> Cc: Ewan D. Milne <emilne@redhat.com> Cc: Hannes Reinecke <hare@suse.de> Tested-by: Sumanesh Samanta <sumanesh.samanta@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
2d13b1ea9f
commit
d022d18c04
3 changed files with 29 additions and 0 deletions
|
@ -1642,6 +1642,20 @@ static bool scsi_mq_get_budget(struct request_queue *q)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void scsi_mq_set_rq_budget_token(struct request *req, int token)
|
||||||
|
{
|
||||||
|
struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
|
||||||
|
|
||||||
|
cmd->budget_token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int scsi_mq_get_rq_budget_token(struct request *req)
|
||||||
|
{
|
||||||
|
struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
|
||||||
|
|
||||||
|
return cmd->budget_token;
|
||||||
|
}
|
||||||
|
|
||||||
static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
|
static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
|
||||||
const struct blk_mq_queue_data *bd)
|
const struct blk_mq_queue_data *bd)
|
||||||
{
|
{
|
||||||
|
@ -1856,6 +1870,8 @@ static const struct blk_mq_ops scsi_mq_ops_no_commit = {
|
||||||
.cleanup_rq = scsi_cleanup_rq,
|
.cleanup_rq = scsi_cleanup_rq,
|
||||||
.busy = scsi_mq_lld_busy,
|
.busy = scsi_mq_lld_busy,
|
||||||
.map_queues = scsi_map_queues,
|
.map_queues = scsi_map_queues,
|
||||||
|
.set_rq_budget_token = scsi_mq_set_rq_budget_token,
|
||||||
|
.get_rq_budget_token = scsi_mq_get_rq_budget_token,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1884,6 +1900,8 @@ static const struct blk_mq_ops scsi_mq_ops = {
|
||||||
.cleanup_rq = scsi_cleanup_rq,
|
.cleanup_rq = scsi_cleanup_rq,
|
||||||
.busy = scsi_mq_lld_busy,
|
.busy = scsi_mq_lld_busy,
|
||||||
.map_queues = scsi_map_queues,
|
.map_queues = scsi_map_queues,
|
||||||
|
.set_rq_budget_token = scsi_mq_set_rq_budget_token,
|
||||||
|
.get_rq_budget_token = scsi_mq_get_rq_budget_token,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev)
|
struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev)
|
||||||
|
|
|
@ -313,6 +313,15 @@ struct blk_mq_ops {
|
||||||
*/
|
*/
|
||||||
void (*put_budget)(struct request_queue *);
|
void (*put_budget)(struct request_queue *);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @set_rq_budget_toekn: store rq's budget token
|
||||||
|
*/
|
||||||
|
void (*set_rq_budget_token)(struct request *, int);
|
||||||
|
/*
|
||||||
|
* @get_rq_budget_toekn: retrieve rq's budget token
|
||||||
|
*/
|
||||||
|
int (*get_rq_budget_token)(struct request *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @timeout: Called on request timeout.
|
* @timeout: Called on request timeout.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -75,6 +75,8 @@ struct scsi_cmnd {
|
||||||
|
|
||||||
int eh_eflags; /* Used by error handlr */
|
int eh_eflags; /* Used by error handlr */
|
||||||
|
|
||||||
|
int budget_token;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is set to jiffies as it was when the command was first
|
* This is set to jiffies as it was when the command was first
|
||||||
* allocated. It is used to time how long the command has
|
* allocated. It is used to time how long the command has
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue