|
@@ -1287,7 +1287,7 @@ static void nvme_config_discard(struct nvme_ctrl *ctrl,
|
|
|
BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
|
|
|
NVME_DSM_MAX_RANGES);
|
|
|
|
|
|
- queue->limits.discard_alignment = size;
|
|
|
+ queue->limits.discard_alignment = 0;
|
|
|
queue->limits.discard_granularity = size;
|
|
|
|
|
|
blk_queue_max_discard_sectors(queue, UINT_MAX);
|
|
@@ -1705,7 +1705,8 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
|
|
|
blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors);
|
|
|
blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX));
|
|
|
}
|
|
|
- if (ctrl->quirks & NVME_QUIRK_STRIPE_SIZE)
|
|
|
+ if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) &&
|
|
|
+ is_power_of_2(ctrl->max_hw_sectors))
|
|
|
blk_queue_chunk_sectors(q, ctrl->max_hw_sectors);
|
|
|
blk_queue_virt_boundary(q, ctrl->page_size - 1);
|
|
|
if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
|
|
@@ -2869,7 +2870,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
|
|
|
|
|
|
blk_queue_logical_block_size(ns->queue, 1 << ns->lba_shift);
|
|
|
nvme_set_queue_limits(ctrl, ns->queue);
|
|
|
- nvme_setup_streams_ns(ctrl, ns);
|
|
|
|
|
|
id = nvme_identify_ns(ctrl, nsid);
|
|
|
if (!id)
|
|
@@ -2880,6 +2880,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
|
|
|
|
|
|
if (nvme_init_ns_head(ns, nsid, id, &new))
|
|
|
goto out_free_id;
|
|
|
+ nvme_setup_streams_ns(ctrl, ns);
|
|
|
|
|
|
#ifdef CONFIG_NVME_MULTIPATH
|
|
|
/*
|
|
@@ -2965,8 +2966,6 @@ static void nvme_ns_remove(struct nvme_ns *ns)
|
|
|
return;
|
|
|
|
|
|
if (ns->disk && ns->disk->flags & GENHD_FL_UP) {
|
|
|
- if (blk_get_integrity(ns->disk))
|
|
|
- blk_integrity_unregister(ns->disk);
|
|
|
nvme_mpath_remove_disk_links(ns);
|
|
|
sysfs_remove_group(&disk_to_dev(ns->disk)->kobj,
|
|
|
&nvme_ns_id_attr_group);
|
|
@@ -2974,6 +2973,8 @@ static void nvme_ns_remove(struct nvme_ns *ns)
|
|
|
nvme_nvm_unregister_sysfs(ns);
|
|
|
del_gendisk(ns->disk);
|
|
|
blk_cleanup_queue(ns->queue);
|
|
|
+ if (blk_get_integrity(ns->disk))
|
|
|
+ blk_integrity_unregister(ns->disk);
|
|
|
}
|
|
|
|
|
|
mutex_lock(&ns->ctrl->subsys->lock);
|