nvme: merge nvme_keep_alive into nvme_keep_alive_work
Merge nvme_keep_alive into its only caller to prepare for additional changes to this code. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Daniel Wagner <dwagner@suse.de>
This commit is contained in:
@@ -1226,28 +1226,12 @@ static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status)
|
|||||||
queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
|
queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nvme_keep_alive(struct nvme_ctrl *ctrl)
|
|
||||||
{
|
|
||||||
struct request *rq;
|
|
||||||
|
|
||||||
rq = nvme_alloc_request(ctrl->admin_q, &ctrl->ka_cmd,
|
|
||||||
BLK_MQ_REQ_RESERVED);
|
|
||||||
if (IS_ERR(rq))
|
|
||||||
return PTR_ERR(rq);
|
|
||||||
|
|
||||||
rq->timeout = ctrl->kato * HZ;
|
|
||||||
rq->end_io_data = ctrl;
|
|
||||||
|
|
||||||
blk_execute_rq_nowait(NULL, rq, 0, nvme_keep_alive_end_io);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void nvme_keep_alive_work(struct work_struct *work)
|
static void nvme_keep_alive_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct nvme_ctrl *ctrl = container_of(to_delayed_work(work),
|
struct nvme_ctrl *ctrl = container_of(to_delayed_work(work),
|
||||||
struct nvme_ctrl, ka_work);
|
struct nvme_ctrl, ka_work);
|
||||||
bool comp_seen = ctrl->comp_seen;
|
bool comp_seen = ctrl->comp_seen;
|
||||||
|
struct request *rq;
|
||||||
|
|
||||||
if ((ctrl->ctratt & NVME_CTRL_ATTR_TBKAS) && comp_seen) {
|
if ((ctrl->ctratt & NVME_CTRL_ATTR_TBKAS) && comp_seen) {
|
||||||
dev_dbg(ctrl->device,
|
dev_dbg(ctrl->device,
|
||||||
@@ -1257,12 +1241,18 @@ static void nvme_keep_alive_work(struct work_struct *work)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nvme_keep_alive(ctrl)) {
|
rq = nvme_alloc_request(ctrl->admin_q, &ctrl->ka_cmd,
|
||||||
|
BLK_MQ_REQ_RESERVED);
|
||||||
|
if (IS_ERR(rq)) {
|
||||||
/* allocation failure, reset the controller */
|
/* allocation failure, reset the controller */
|
||||||
dev_err(ctrl->device, "keep-alive failed\n");
|
dev_err(ctrl->device, "keep-alive failed\n");
|
||||||
nvme_reset_ctrl(ctrl);
|
nvme_reset_ctrl(ctrl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rq->timeout = ctrl->kato * HZ;
|
||||||
|
rq->end_io_data = ctrl;
|
||||||
|
blk_execute_rq_nowait(NULL, rq, 0, nvme_keep_alive_end_io);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvme_start_keep_alive(struct nvme_ctrl *ctrl)
|
static void nvme_start_keep_alive(struct nvme_ctrl *ctrl)
|
||||||
|
|||||||
Reference in New Issue
Block a user