Skip to content

Commit 599d9f3

Browse files
shroffnikeithbusch
authored andcommitted
nvme: use helper nvme_ctrl_state in nvme_keep_alive_finish function
We no more need acquiring ctrl->lock before accessing the NVMe controller state and instead we can now use the helper nvme_ctrl_state. So replace the use of ctrl->lock from nvme_keep_alive_finish function with nvme_ctrl_state call. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent d069236 commit 599d9f3

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

drivers/nvme/host/core.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,10 +1295,9 @@ static void nvme_queue_keep_alive_work(struct nvme_ctrl *ctrl)
12951295
static void nvme_keep_alive_finish(struct request *rq,
12961296
blk_status_t status, struct nvme_ctrl *ctrl)
12971297
{
1298-
unsigned long flags;
1299-
bool startka = false;
13001298
unsigned long rtt = jiffies - (rq->deadline - rq->timeout);
13011299
unsigned long delay = nvme_keep_alive_work_period(ctrl);
1300+
enum nvme_ctrl_state state = nvme_ctrl_state(ctrl);
13021301

13031302
/*
13041303
* Subtract off the keepalive RTT so nvme_keep_alive_work runs
@@ -1321,12 +1320,7 @@ static void nvme_keep_alive_finish(struct request *rq,
13211320

13221321
ctrl->ka_last_check_time = jiffies;
13231322
ctrl->comp_seen = false;
1324-
spin_lock_irqsave(&ctrl->lock, flags);
1325-
if (ctrl->state == NVME_CTRL_LIVE ||
1326-
ctrl->state == NVME_CTRL_CONNECTING)
1327-
startka = true;
1328-
spin_unlock_irqrestore(&ctrl->lock, flags);
1329-
if (startka)
1323+
if (state == NVME_CTRL_LIVE || state == NVME_CTRL_CONNECTING)
13301324
queue_delayed_work(nvme_wq, &ctrl->ka_work, delay);
13311325
}
13321326

0 commit comments

Comments
 (0)