nvme: fix sector units when going between formats
If you format a device with a 4k sector size back to 512 bytes, the queue limit values for physical block size and minimum IO size were not getting updated; only the logical block size was being updated. This patch adds code to update the physical block and IO minimum sizes. Signed-off-by: Jeff Lien <jeff.lien@wdc.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Родитель
955b1b5a00
Коммит
cee160fd34
|
@ -1335,6 +1335,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
|
|||
struct nvme_ns *ns, struct nvme_id_ns *id)
|
||||
{
|
||||
sector_t capacity = le64_to_cpup(&id->nsze) << (ns->lba_shift - 9);
|
||||
unsigned short bs = 1 << ns->lba_shift;
|
||||
unsigned stream_alignment = 0;
|
||||
|
||||
if (ns->ctrl->nr_streams && ns->sws && ns->sgs)
|
||||
|
@ -1343,7 +1344,10 @@ static void nvme_update_disk_info(struct gendisk *disk,
|
|||
blk_mq_freeze_queue(disk->queue);
|
||||
blk_integrity_unregister(disk);
|
||||
|
||||
blk_queue_logical_block_size(disk->queue, 1 << ns->lba_shift);
|
||||
blk_queue_logical_block_size(disk->queue, bs);
|
||||
blk_queue_physical_block_size(disk->queue, bs);
|
||||
blk_queue_io_min(disk->queue, bs);
|
||||
|
||||
if (ns->ms && !ns->ext &&
|
||||
(ns->ctrl->ops->flags & NVME_F_METADATA_SUPPORTED))
|
||||
nvme_init_integrity(disk, ns->ms, ns->pi_type);
|
||||
|
|
Загрузка…
Ссылка в новой задаче