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>
memcmp(&a->eui64, &b->eui64, sizeof(a->eui64)) == 0;
}
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;
{
struct streams_directive_params s;
int ret;
ns->sgs = le16_to_cpu(s.sgs);
if (ns->sws) {
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);
- blk_queue_io_opt(ns->queue, bs * ns->sws * ns->sgs);
+ *io_opt = *phys_bs * ns->sgs;
blk_mq_freeze_queue(disk->queue);
blk_integrity_unregister(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
if (id->nabo == 0) {
/*
* Bit 1 indicates whether NAWUPF is defined for this namespace
atomic_bs = (1 + le16_to_cpu(id->nawupf)) * bs;
else
atomic_bs = (1 + ns->ctrl->subsys->awupf) * bs;
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 */
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 */
/* 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);
}
blk_queue_logical_block_size(disk->queue, bs);