summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>2018-12-12 15:11:48 -0800
committerChristoph Hellwig <hch@lst.de>2018-12-13 09:59:07 +0100
commit23454d59cc16ddddf4b2290bbe60d2d9581dfd9a (patch)
tree4e5b6ebc7debb617e747163b95faeeab9f835923
parent11ad507784ed5113af97903af1b0c4aea6b90690 (diff)
downloadlinux-stable-23454d59cc16ddddf4b2290bbe60d2d9581dfd9a.tar.gz
linux-stable-23454d59cc16ddddf4b2290bbe60d2d9581dfd9a.tar.bz2
linux-stable-23454d59cc16ddddf4b2290bbe60d2d9581dfd9a.zip
nvmet: update smart log with num err log entries
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>
-rw-r--r--drivers/nvme/target/admin-cmd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 00956b4106a8..11baeb14c388 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -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;
@@ -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);