Skip to content

Commit

Permalink
nvmet: update smart log with num err log entries
Browse files Browse the repository at this point in the history
Now that we have error log page implementation update smart log command
handler to provide number of error log entries in the lifetime of the
controller field.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Chaitanya Kulkarni authored and Christoph Hellwig committed Dec 13, 2018
1 parent 11ad507 commit 23454d5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/nvme/target/admin-cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ static void nvmet_execute_get_log_page_smart(struct nvmet_req *req)
{
struct nvme_smart_log *log;
u16 status = NVME_SC_INTERNAL;
unsigned long flags;

if (req->data_len != sizeof(*log))
goto out;
Expand All @@ -150,6 +151,11 @@ static void nvmet_execute_get_log_page_smart(struct nvmet_req *req)
if (status)
goto out_free_log;

spin_lock_irqsave(&req->sq->ctrl->error_lock, flags);
put_unaligned_le64(req->sq->ctrl->err_counter,
&log->num_err_log_entries);
spin_unlock_irqrestore(&req->sq->ctrl->error_lock, flags);

status = nvmet_copy_to_sgl(req, 0, log, sizeof(*log));
out_free_log:
kfree(log);
Expand Down

0 comments on commit 23454d5

Please sign in to comment.