Commit 23454d59 authored by Chaitanya Kulkarni's avatar Chaitanya Kulkarni Committed by Christoph Hellwig
Browse files

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: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 11ad5077
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -135,6 +135,7 @@ static void nvmet_execute_get_log_page_smart(struct nvmet_req *req)
{
{
	struct nvme_smart_log *log;
	struct nvme_smart_log *log;
	u16 status = NVME_SC_INTERNAL;
	u16 status = NVME_SC_INTERNAL;
	unsigned long flags;


	if (req->data_len != sizeof(*log))
	if (req->data_len != sizeof(*log))
		goto out;
		goto out;
@@ -150,6 +151,11 @@ static void nvmet_execute_get_log_page_smart(struct nvmet_req *req)
	if (status)
	if (status)
		goto out_free_log;
		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));
	status = nvmet_copy_to_sgl(req, 0, log, sizeof(*log));
out_free_log:
out_free_log:
	kfree(log);
	kfree(log);