mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
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>
This commit is contained in:
parent
a42ceccef0
commit
8fc23e032d
2 changed files with 8 additions and 0 deletions
|
@ -78,6 +78,7 @@ struct nvme_dev {
|
||||||
char serial[20];
|
char serial[20];
|
||||||
char model[40];
|
char model[40];
|
||||||
char firmware_rev[8];
|
char firmware_rev[8];
|
||||||
|
u32 max_hw_sectors;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1344,6 +1345,8 @@ static struct nvme_ns *nvme_alloc_ns(struct nvme_dev *dev, int nsid,
|
||||||
lbaf = id->flbas & 0xf;
|
lbaf = id->flbas & 0xf;
|
||||||
ns->lba_shift = id->lbaf[lbaf].ds;
|
ns->lba_shift = id->lbaf[lbaf].ds;
|
||||||
blk_queue_logical_block_size(ns->queue, 1 << ns->lba_shift);
|
blk_queue_logical_block_size(ns->queue, 1 << ns->lba_shift);
|
||||||
|
if (dev->max_hw_sectors)
|
||||||
|
blk_queue_max_hw_sectors(ns->queue, dev->max_hw_sectors);
|
||||||
|
|
||||||
disk->major = nvme_major;
|
disk->major = nvme_major;
|
||||||
disk->minors = NVME_MINORS;
|
disk->minors = NVME_MINORS;
|
||||||
|
@ -1485,6 +1488,10 @@ static int __devinit nvme_dev_add(struct nvme_dev *dev)
|
||||||
memcpy(dev->serial, ctrl->sn, sizeof(ctrl->sn));
|
memcpy(dev->serial, ctrl->sn, sizeof(ctrl->sn));
|
||||||
memcpy(dev->model, ctrl->mn, sizeof(ctrl->mn));
|
memcpy(dev->model, ctrl->mn, sizeof(ctrl->mn));
|
||||||
memcpy(dev->firmware_rev, ctrl->fr, sizeof(ctrl->fr));
|
memcpy(dev->firmware_rev, ctrl->fr, sizeof(ctrl->fr));
|
||||||
|
if (ctrl->mdts) {
|
||||||
|
int shift = NVME_CAP_MPSMIN(readq(&dev->bar->cap)) + 12;
|
||||||
|
dev->max_hw_sectors = 1 << (ctrl->mdts + shift - 9);
|
||||||
|
}
|
||||||
|
|
||||||
id_ns = mem;
|
id_ns = mem;
|
||||||
for (i = 1; i <= nn; i++) {
|
for (i = 1; i <= nn; i++) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ struct nvme_bar {
|
||||||
|
|
||||||
#define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff)
|
#define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff)
|
||||||
#define NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf)
|
#define NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf)
|
||||||
|
#define NVME_CAP_MPSMIN(cap) (((cap) >> 48) & 0xf)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NVME_CC_ENABLE = 1 << 0,
|
NVME_CC_ENABLE = 1 << 0,
|
||||||
|
|
Loading…
Reference in a new issue