[PATCH 1/3] nvme: add a quirk to disable namespace identifiers
Chaitanya Kulkarni
chaitanyak at nvidia.com
Mon Apr 11 23:56:07 PDT 2022
On 4/11/22 23:11, Christoph Hellwig wrote:
> Add a quirk to disable using and exporting namespace identifiers for
> controllers where they are broken beyond repair.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
if possible take that quirk check out see [1] it is but more
code but look much clean, either way looks good.
Reviewed-by: Chaitanya Kulkarni <kch at nvidia.com>
-ck
[1] totally untested :-
+static int nvme_id_check_quirk(u64 nidt)
+{
+ switch (cur->nidt) {
+ case NVME_NIDT_EUI64:
+ if (ctrl->quirks & NVME_QUIRK_BOGUS_NID)
+ return NVME_NIDT_EUI64_LEN;
+ return 0;
+ case NVME_NIDT_NGUID:
+ if (ctrl->quirks & NVME_QUIRK_BOGUS_NID)
+ return NVME_NIDT_NGUID_LEN;
+ return 0;
+ case NVME_NIDT_UUID:
+ if (ctrl->quirks & NVME_QUIRK_BOGUS_NID)
+ return NVME_NIDT_UUID_LEN;
+ return 0;
+ default:
+ return 0;
+ }
+}
+
static int nvme_process_ns_desc(struct nvme_ctrl *ctrl, struct
nvme_ns_ids *ids,
struct nvme_ns_id_desc *cur, bool *csi_seen)
{
const char *warn_str = "ctrl returned bogus length:";
void *data = cur;
+ int ret;
+
+ ret = nvme_id_check_quirk(cur->nidt);
+ if (ret)
+ return ret;
switch (cur->nidt) {
case NVME_NIDT_EUI64:
More information about the Linux-nvme
mailing list