/*
         * The block layer can't support LBA sizes larger than the page size
 -       * yet, so catch this early and don't allow block I/O.
 +       * or smaller than a sector size yet, so catch this early and don't
 +       * allow block I/O.
         */
-       if (ns->lba_shift > PAGE_SHIFT || ns->lba_shift < SECTOR_SHIFT) {
 -      if (head->lba_shift > PAGE_SHIFT) {
++      if (head->lba_shift > PAGE_SHIFT || head->lba_shift < SECTOR_SHIFT) {
                capacity = 0;
                bs = (1 << 9);
        }
        if (ret)
                return ret;
  
 +      if (id->ncap == 0) {
 +              /* namespace not allocated or attached */
 +              info->is_removed = true;
 +              ret = -ENODEV;
 +              goto error;
 +      }
 +
        blk_mq_freeze_queue(ns->disk->queue);
        lbaf = nvme_lbaf_index(id->flbas);
-       ns->lba_shift = id->lbaf[lbaf].ds;
+       ns->head->lba_shift = id->lbaf[lbaf].ds;
+       ns->head->nuse = le64_to_cpu(id->nuse);
        nvme_set_queue_limits(ns->ctrl, ns->queue);
  
-       ret = nvme_configure_metadata(ns, id);
+       ret = nvme_configure_metadata(ns->ctrl, ns->head, id);
        if (ret < 0) {
                blk_mq_unfreeze_queue(ns->disk->queue);
                goto out;
 
                        (bdev_zone_sectors(bdev) << SECTOR_SHIFT);
        }
  
 -      /* Do not allow Host Manged zoned device */
 +      /* Do not allow Host Managed zoned device. */
-       return bdev_zoned_model(bdev) != BLK_ZONED_HM;
+       return !bdev_is_zoned(bdev);
  }
  
  static inline bool btrfs_check_super_location(struct btrfs_device *device, u64 pos)