Skip to content

Commit

Permalink
Merge branch 'nvme-4.18' of git://git.infradead.org/nvme into for-4.1…
Browse files Browse the repository at this point in the history
…8/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
  • Loading branch information
axboe committed May 21, 2018
2 parents d416c92 + 1eae349 commit 81b1dab
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 94 deletions.
30 changes: 17 additions & 13 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1348,23 +1348,32 @@ static void nvme_set_chunk_size(struct nvme_ns *ns)
blk_queue_chunk_sectors(ns->queue, rounddown_pow_of_two(chunk_size));
}

static void nvme_config_discard(struct nvme_ctrl *ctrl,
unsigned stream_alignment, struct request_queue *queue)
static void nvme_config_discard(struct nvme_ns *ns)
{
struct nvme_ctrl *ctrl = ns->ctrl;
struct request_queue *queue = ns->queue;
u32 size = queue_logical_block_size(queue);

if (stream_alignment)
size *= stream_alignment;
if (!(ctrl->oncs & NVME_CTRL_ONCS_DSM)) {
blk_queue_flag_clear(QUEUE_FLAG_DISCARD, queue);
return;
}

if (ctrl->nr_streams && ns->sws && ns->sgs)
size *= ns->sws * ns->sgs;

BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
NVME_DSM_MAX_RANGES);

queue->limits.discard_alignment = 0;
queue->limits.discard_granularity = size;

/* If discard is already enabled, don't reset queue limits */
if (blk_queue_flag_test_and_set(QUEUE_FLAG_DISCARD, queue))
return;

blk_queue_max_discard_sectors(queue, UINT_MAX);
blk_queue_max_discard_segments(queue, NVME_DSM_MAX_RANGES);
blk_queue_flag_set(QUEUE_FLAG_DISCARD, queue);

if (ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES)
blk_queue_max_write_zeroes_sectors(queue, UINT_MAX);
Expand Down Expand Up @@ -1408,10 +1417,6 @@ static void nvme_update_disk_info(struct gendisk *disk,
{
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)
stream_alignment = ns->sws * ns->sgs;

blk_mq_freeze_queue(disk->queue);
blk_integrity_unregister(disk);
Expand All @@ -1425,10 +1430,9 @@ static void nvme_update_disk_info(struct gendisk *disk,
nvme_init_integrity(disk, ns->ms, ns->pi_type);
if (ns->ms && !nvme_ns_has_pi(ns) && !blk_get_integrity(disk))
capacity = 0;
set_capacity(disk, capacity);

if (ns->ctrl->oncs & NVME_CTRL_ONCS_DSM)
nvme_config_discard(ns->ctrl, stream_alignment, disk->queue);
set_capacity(disk, capacity);
nvme_config_discard(ns);
blk_mq_unfreeze_queue(disk->queue);
}

Expand Down Expand Up @@ -3317,7 +3321,7 @@ static void nvme_fw_act_work(struct work_struct *work)
}

void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
union nvme_result *res)
volatile union nvme_result *res)
{
u32 result = le32_to_cpu(res->u32);

Expand Down
2 changes: 2 additions & 0 deletions drivers/nvme/host/fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3284,6 +3284,8 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts)
}
spin_unlock_irqrestore(&nvme_fc_lock, flags);

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

Expand Down
2 changes: 1 addition & 1 deletion drivers/nvme/host/nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ int nvme_sec_submit(void *data, u16 spsp, u8 secp, void *buffer, size_t len,
bool send);

void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
union nvme_result *res);
volatile union nvme_result *res);

void nvme_stop_queues(struct nvme_ctrl *ctrl);
void nvme_start_queues(struct nvme_ctrl *ctrl);
Expand Down
Loading

0 comments on commit 81b1dab

Please sign in to comment.