nvme: consolodate io settings
The stream parameters indicating optimal io settings were just getting overwritten later. Rearrange the settings so the streams parameters can be preserved if provided. Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
bc1af009a8
commit
31fdad7be1
@ -1810,7 +1810,8 @@ static bool nvme_ns_ids_equal(struct nvme_ns_ids *a, struct nvme_ns_ids *b)
|
||||
memcmp(&a->eui64, &b->eui64, sizeof(a->eui64)) == 0;
|
||||
}
|
||||
|
||||
static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns)
|
||||
static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
|
||||
u32 *phys_bs, u32 *io_opt)
|
||||
{
|
||||
struct streams_directive_params s;
|
||||
int ret;
|
||||
@ -1826,11 +1827,9 @@ static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns)
|
||||
ns->sgs = le16_to_cpu(s.sgs);
|
||||
|
||||
if (ns->sws) {
|
||||
unsigned int bs = 1 << ns->lba_shift;
|
||||
|
||||
blk_queue_io_min(ns->queue, bs * ns->sws);
|
||||
*phys_bs = ns->sws * (1 << ns->lba_shift);
|
||||
if (ns->sgs)
|
||||
blk_queue_io_opt(ns->queue, bs * ns->sws * ns->sgs);
|
||||
*io_opt = *phys_bs * ns->sgs;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1850,7 +1849,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
|
||||
blk_mq_freeze_queue(disk->queue);
|
||||
blk_integrity_unregister(disk);
|
||||
|
||||
nvme_setup_streams_ns(ns->ctrl, ns);
|
||||
atomic_bs = phys_bs = io_opt = bs;
|
||||
nvme_setup_streams_ns(ns->ctrl, ns, &phys_bs, &io_opt);
|
||||
if (id->nabo == 0) {
|
||||
/*
|
||||
* Bit 1 indicates whether NAWUPF is defined for this namespace
|
||||
@ -1861,16 +1861,13 @@ static void nvme_update_disk_info(struct gendisk *disk,
|
||||
atomic_bs = (1 + le16_to_cpu(id->nawupf)) * bs;
|
||||
else
|
||||
atomic_bs = (1 + ns->ctrl->subsys->awupf) * bs;
|
||||
} else {
|
||||
atomic_bs = bs;
|
||||
}
|
||||
phys_bs = bs;
|
||||
io_opt = bs;
|
||||
|
||||
if (id->nsfeat & (1 << 4)) {
|
||||
/* NPWG = Namespace Preferred Write Granularity */
|
||||
phys_bs *= 1 + le16_to_cpu(id->npwg);
|
||||
phys_bs = bs * (1 + le16_to_cpu(id->npwg));
|
||||
/* NOWS = Namespace Optimal Write Size */
|
||||
io_opt *= 1 + le16_to_cpu(id->nows);
|
||||
io_opt = bs * (1 + le16_to_cpu(id->nows));
|
||||
}
|
||||
|
||||
blk_queue_logical_block_size(disk->queue, bs);
|
||||
|
Loading…
Reference in New Issue
Block a user