aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2012-07-26 13:29:57 -0400
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2012-07-26 13:43:20 -0400
commit8fc23e032debd682f5ba9fc524a5846c10d2c522 (patch)
treeb940a216734f2c947cfae5ac9a80b45a86c506e3 /drivers
parenta42ceccef0c43b46ff6bc1b12a7c1076ef243df1 (diff)
NVMe: Set block queue max sectors
Set the max hw sectors in a namespace's request queue if the nvme device has a max data transfer size. Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/nvme.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index 7bcd88205a41..11951fa11a90 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -78,6 +78,7 @@ struct nvme_dev {
78 char serial[20]; 78 char serial[20];
79 char model[40]; 79 char model[40];
80 char firmware_rev[8]; 80 char firmware_rev[8];
81 u32 max_hw_sectors;
81}; 82};
82 83
83/* 84/*
@@ -1344,6 +1345,8 @@ static struct nvme_ns *nvme_alloc_ns(struct nvme_dev *dev, int nsid,
1344 lbaf = id->flbas & 0xf; 1345 lbaf = id->flbas & 0xf;
1345 ns->lba_shift = id->lbaf[lbaf].ds; 1346 ns->lba_shift = id->lbaf[lbaf].ds;
1346 blk_queue_logical_block_size(ns->queue, 1 << ns->lba_shift); 1347 blk_queue_logical_block_size(ns->queue, 1 << ns->lba_shift);
1348 if (dev->max_hw_sectors)
1349 blk_queue_max_hw_sectors(ns->queue, dev->max_hw_sectors);
1347 1350
1348 disk->major = nvme_major; 1351 disk->major = nvme_major;
1349 disk->minors = NVME_MINORS; 1352 disk->minors = NVME_MINORS;
@@ -1485,6 +1488,10 @@ static int __devinit nvme_dev_add(struct nvme_dev *dev)
1485 memcpy(dev->serial, ctrl->sn, sizeof(ctrl->sn)); 1488 memcpy(dev->serial, ctrl->sn, sizeof(ctrl->sn));
1486 memcpy(dev->model, ctrl->mn, sizeof(ctrl->mn)); 1489 memcpy(dev->model, ctrl->mn, sizeof(ctrl->mn));
1487 memcpy(dev->firmware_rev, ctrl->fr, sizeof(ctrl->fr)); 1490 memcpy(dev->firmware_rev, ctrl->fr, sizeof(ctrl->fr));
1491 if (ctrl->mdts) {
1492 int shift = NVME_CAP_MPSMIN(readq(&dev->bar->cap)) + 12;
1493 dev->max_hw_sectors = 1 << (ctrl->mdts + shift - 9);
1494 }
1488 1495
1489 id_ns = mem; 1496 id_ns = mem;
1490 for (i = 1; i <= nn; i++) { 1497 for (i = 1; i <= nn; i++) {