瀏覽代碼

nvme: count all ANA groups for ANA Log page

When issuing a short read on the ANA log page the number of groups
should not change, even though the final returned data might contain
less groups than that number.

Signed-off-by: Hannes Reinecke <hare@suse.com>
[switched to a for loop]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Hannes Reinecke 7 年之前
父節點
當前提交
be1277f5eb
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      drivers/nvme/target/admin-cmd.c

+ 4 - 0
drivers/nvme/target/admin-cmd.c

@@ -245,6 +245,10 @@ static void nvmet_execute_get_log_page_ana(struct nvmet_req *req)
 		offset += len;
 		ngrps++;
 	}
+	for ( ; grpid <= NVMET_MAX_ANAGRPS; grpid++) {
+		if (nvmet_ana_group_enabled[grpid])
+			ngrps++;
+	}
 
 	hdr.chgcnt = cpu_to_le64(nvmet_ana_chgcnt);
 	hdr.ngrps = cpu_to_le16(ngrps);