Print this page
8480 nvmeadm should ignore 0-sized namespaces by default
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/nvmeadm/nvmeadm.c
          +++ new/usr/src/cmd/nvmeadm/nvmeadm.c
↓ open down ↓ 531 lines elided ↑ open up ↑
 532  532              "  List NVMe controllers and their namespaces. If no "
 533  533              "controllers and/or name-\n  spaces are specified, all "
 534  534              "controllers and namespaces in the system will be\n  "
 535  535              "listed.\n", c_name);
 536  536  }
 537  537  
 538  538  static int
 539  539  do_list_nsid(int fd, const nvme_process_arg_t *npa)
 540  540  {
 541  541          _NOTE(ARGUNUSED(fd));
      542 +        const uint_t format = npa->npa_idns->id_flbas.lba_format;
      543 +        const uint_t bshift = npa->npa_idns->id_lbaf[format].lbaf_lbads;
 542  544  
      545 +        /*
      546 +         * Some devices have extra namespaces with illegal block sizes and
      547 +         * zero blocks. Don't list them when verbose operation isn't requested.
      548 +         */
      549 +        if ((bshift < 9 || npa->npa_idns->id_nsize == 0) && verbose == 0)
      550 +                return (0);
      551 +
 543  552          (void) printf("  %s/%s (%s): ", npa->npa_name,
 544  553              di_minor_name(npa->npa_minor),
 545  554              npa->npa_dsk != NULL ? npa->npa_dsk : "unattached");
 546  555          nvme_print_nsid_summary(npa->npa_idns);
 547  556  
 548  557          return (0);
 549  558  }
 550  559  
 551  560  static int
 552  561  do_list(int fd, const nvme_process_arg_t *npa)
↓ open down ↓ 453 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX