Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323249
b: refs/heads/master
c: a0cadb8
h: refs/heads/master
i:
  323247: ba018fd
v: v3
  • Loading branch information
Keith Busch authored and Matthew Wilcox committed Jul 27, 2012
1 parent 606dd2e commit 6dcdc40
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8fc23e032debd682f5ba9fc524a5846c10d2c522
refs/heads/master: a0cadb85b8b758608ae0759151e29de7581c6731
10 changes: 6 additions & 4 deletions trunk/drivers/block/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,8 @@ static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid,
int depth, int vector)
{
struct device *dmadev = &dev->pci_dev->dev;
unsigned extra = (depth / 8) + (depth * sizeof(struct nvme_cmd_info));
unsigned extra = DIV_ROUND_UP(depth, 8) + (depth *
sizeof(struct nvme_cmd_info));
struct nvme_queue *nvmeq = kzalloc(sizeof(*nvmeq) + extra, GFP_KERNEL);
if (!nvmeq)
return NULL;
Expand Down Expand Up @@ -1391,7 +1392,7 @@ static int set_queue_count(struct nvme_dev *dev, int count)

static int __devinit nvme_setup_io_queues(struct nvme_dev *dev)
{
int result, cpu, i, nr_io_queues, db_bar_size;
int result, cpu, i, nr_io_queues, db_bar_size, q_depth;

nr_io_queues = num_online_cpus();
result = set_queue_count(dev, nr_io_queues);
Expand Down Expand Up @@ -1437,9 +1438,10 @@ static int __devinit nvme_setup_io_queues(struct nvme_dev *dev)
cpu = cpumask_next(cpu, cpu_online_mask);
}

q_depth = min_t(int, NVME_CAP_MQES(readq(&dev->bar->cap)) + 1,
NVME_Q_DEPTH);
for (i = 0; i < nr_io_queues; i++) {
dev->queues[i + 1] = nvme_create_queue(dev, i + 1,
NVME_Q_DEPTH, i);
dev->queues[i + 1] = nvme_create_queue(dev, i + 1, q_depth, i);
if (IS_ERR(dev->queues[i + 1]))
return PTR_ERR(dev->queues[i + 1]);
dev->queue_count++;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct nvme_bar {
__u64 acq; /* Admin CQ Base Address */
};

#define NVME_CAP_MQES(cap) ((cap) & 0xffff)
#define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff)
#define NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf)
#define NVME_CAP_MPSMIN(cap) (((cap) >> 48) & 0xf)
Expand Down

0 comments on commit 6dcdc40

Please sign in to comment.