+static void nvmet_execute_identify_desclist(struct nvmet_req *req)
+{
+ struct nvmet_ns *ns;
+ struct nvme_ns_identifier_hdr hdr;
+ u16 status = 0;
+ off_t off = 0;
+
+ ns = nvmet_find_namespace(req->sq->ctrl, req->cmd->identify.nsid);
+ if (!ns) {
+ status = NVME_SC_INVALID_NS | NVME_SC_DNR;
+ goto out;
+ }
+
+ if (memchr_inv(&ns->uuid, 0, sizeof(ns->uuid))) {
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.nidt = NVME_NIDT_UUID;
+ hdr.nidl = NVME_NIDT_UUID_LEN;
+ status = nvmet_copy_to_sgl(req, off, &hdr, sizeof(hdr));
+ if (status)
+ goto out_put_ns;
+ off += sizeof(hdr);
+
+ status = nvmet_copy_to_sgl(req, off, &ns->uuid,
+ sizeof(ns->uuid));
+ if (status)
+ goto out_put_ns;
+ off += sizeof(ns->uuid);
+ }
+ if (memchr_inv(ns->nguid, 0, sizeof(ns->nguid))) {
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.nidt = NVME_NIDT_NGUID;
+ hdr.nidl = NVME_NIDT_NGUID_LEN;
+ status = nvmet_copy_to_sgl(req, off, &hdr, sizeof(hdr));
+ if (status)
+ goto out_put_ns;
+ off += sizeof(hdr);
+
+ status = nvmet_copy_to_sgl(req, off, &ns->nguid,
+ sizeof(ns->nguid));
+ if (status)
+ goto out_put_ns;
+ off += sizeof(ns->nguid);
+ }