Skip to content

Commit 81b1dab

Browse files
committed
Merge branch 'nvme-4.18' of git://git.infradead.org/nvme into for-4.18/block
Pull NVMe changes from Keith: "This is just the first nvme pull request for 4.18. There are several fabrics and target patches that I missed, so there will be more to come." * 'nvme-4.18' of git://git.infradead.org/nvme: nvme-pci: drop IRQ disabling on submission queue lock nvme-pci: split the nvme queue lock into submission and completion locks nvme-pci: handle completions outside of the queue lock nvme-pci: move ->cq_vector == -1 check outside of ->q_lock nvme-pci: remove cq check after submission nvme-pci: simplify nvme_cqe_valid nvme: mark the result argument to nvme_complete_async_event volatile nvme/pci: Sync controller reset for AER slot_reset nvme/pci: Hold controller reference during async probe nvme: only reconfigure discard if necessary nvme/pci: Use async_schedule for initial reset work nvme: lightnvm: add granby support NVMe: Add Quirk Delay before CHK RDY for Seagate Nytro Flash Storage nvme: change order of qid and cmdid in completion trace nvme: fc: provide a descriptive error
2 parents d416c92 + 1eae349 commit 81b1dab

File tree

5 files changed

+133
-94
lines changed

5 files changed

+133
-94
lines changed

drivers/nvme/host/core.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,23 +1348,32 @@ static void nvme_set_chunk_size(struct nvme_ns *ns)
13481348
blk_queue_chunk_sectors(ns->queue, rounddown_pow_of_two(chunk_size));
13491349
}
13501350

1351-
static void nvme_config_discard(struct nvme_ctrl *ctrl,
1352-
unsigned stream_alignment, struct request_queue *queue)
1351+
static void nvme_config_discard(struct nvme_ns *ns)
13531352
{
1353+
struct nvme_ctrl *ctrl = ns->ctrl;
1354+
struct request_queue *queue = ns->queue;
13541355
u32 size = queue_logical_block_size(queue);
13551356

1356-
if (stream_alignment)
1357-
size *= stream_alignment;
1357+
if (!(ctrl->oncs & NVME_CTRL_ONCS_DSM)) {
1358+
blk_queue_flag_clear(QUEUE_FLAG_DISCARD, queue);
1359+
return;
1360+
}
1361+
1362+
if (ctrl->nr_streams && ns->sws && ns->sgs)
1363+
size *= ns->sws * ns->sgs;
13581364

13591365
BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
13601366
NVME_DSM_MAX_RANGES);
13611367

13621368
queue->limits.discard_alignment = 0;
13631369
queue->limits.discard_granularity = size;
13641370

1371+
/* If discard is already enabled, don't reset queue limits */
1372+
if (blk_queue_flag_test_and_set(QUEUE_FLAG_DISCARD, queue))
1373+
return;
1374+
13651375
blk_queue_max_discard_sectors(queue, UINT_MAX);
13661376
blk_queue_max_discard_segments(queue, NVME_DSM_MAX_RANGES);
1367-
blk_queue_flag_set(QUEUE_FLAG_DISCARD, queue);
13681377

13691378
if (ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES)
13701379
blk_queue_max_write_zeroes_sectors(queue, UINT_MAX);
@@ -1408,10 +1417,6 @@ static void nvme_update_disk_info(struct gendisk *disk,
14081417
{
14091418
sector_t capacity = le64_to_cpup(&id->nsze) << (ns->lba_shift - 9);
14101419
unsigned short bs = 1 << ns->lba_shift;
1411-
unsigned stream_alignment = 0;
1412-
1413-
if (ns->ctrl->nr_streams && ns->sws && ns->sgs)
1414-
stream_alignment = ns->sws * ns->sgs;
14151420

14161421
blk_mq_freeze_queue(disk->queue);
14171422
blk_integrity_unregister(disk);
@@ -1425,10 +1430,9 @@ static void nvme_update_disk_info(struct gendisk *disk,
14251430
nvme_init_integrity(disk, ns->ms, ns->pi_type);
14261431
if (ns->ms && !nvme_ns_has_pi(ns) && !blk_get_integrity(disk))
14271432
capacity = 0;
1428-
set_capacity(disk, capacity);
14291433

1430-
if (ns->ctrl->oncs & NVME_CTRL_ONCS_DSM)
1431-
nvme_config_discard(ns->ctrl, stream_alignment, disk->queue);
1434+
set_capacity(disk, capacity);
1435+
nvme_config_discard(ns);
14321436
blk_mq_unfreeze_queue(disk->queue);
14331437
}
14341438

@@ -3317,7 +3321,7 @@ static void nvme_fw_act_work(struct work_struct *work)
33173321
}
33183322

33193323
void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
3320-
union nvme_result *res)
3324+
volatile union nvme_result *res)
33213325
{
33223326
u32 result = le32_to_cpu(res->u32);
33233327

drivers/nvme/host/fc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3284,6 +3284,8 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts)
32843284
}
32853285
spin_unlock_irqrestore(&nvme_fc_lock, flags);
32863286

3287+
pr_warn("%s: %s - %s combination not found\n",
3288+
__func__, opts->traddr, opts->host_traddr);
32873289
return ERR_PTR(-ENOENT);
32883290
}
32893291

drivers/nvme/host/nvme.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ int nvme_sec_submit(void *data, u16 spsp, u8 secp, void *buffer, size_t len,
400400
bool send);
401401

402402
void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
403-
union nvme_result *res);
403+
volatile union nvme_result *res);
404404

405405
void nvme_stop_queues(struct nvme_ctrl *ctrl);
406406
void nvme_start_queues(struct nvme_ctrl *ctrl);

0 commit comments

Comments
 (0)