Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1657093
| From | Sagi Grimberg <sagi@grimberg.me> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 3/8] nvmet: implement namespace identify descriptor list |
| Date | 2017-06-04 17:10 +0200 |
| Message-ID | <tOFke-6N9-21@gated-at.bofh.it> (permalink) |
| References | <tOB6V-3JJ-5@gated-at.bofh.it> <tOB6W-3JJ-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> +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))) {
Plain override in case a namespace is fed with both uuid and nguid?
Perhaps we should try to help the user a bit here and either fail
the user trying to populate both in configfs or pick one here.
> + 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);
> + }
If none exist we return whatever the the stack contains in hdr...
Lets initialize hdr with {} at the declaration.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 3/8] nvmet: implement namespace identify descriptor list Johannes Thumshirn <jthumshirn@suse.de> - 2017-06-04 12:40 +0200
Re: [PATCH v4 3/8] nvmet: implement namespace identify descriptor list Sagi Grimberg <sagi@grimberg.me> - 2017-06-04 17:10 +0200
Re: [PATCH v4 3/8] nvmet: implement namespace identify descriptor list Christoph Hellwig <hch@lst.de> - 2017-06-05 07:40 +0200
Re: [PATCH v4 3/8] nvmet: implement namespace identify descriptor list Johannes Thumshirn <jthumshirn@suse.de> - 2017-06-06 14:10 +0200
Re: [PATCH v4 3/8] nvmet: implement namespace identify descriptor list Hannes Reinecke <hare@suse.de> - 2017-06-06 08:30 +0200
csiph-web