diff options
author | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2013-03-27 21:28:22 -0400 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2013-04-16 15:05:22 -0400 |
commit | 063cc6d5591ea9c0631b81ac5c7b829d99738b2f (patch) | |
tree | 5a61528a0a76394666fdc42d6b51bf576a7c1002 /drivers/block/nvme-scsi.c | |
parent | acb7aa0db09b8abd38abeb84334a8a27a52fbb1b (diff) | |
download | op-kernel-dev-063cc6d5591ea9c0631b81ac5c7b829d99738b2f.zip op-kernel-dev-063cc6d5591ea9c0631b81ac5c7b829d99738b2f.tar.gz |
NVMe: Abstract out sector to block number conversion
Introduce nvme_block_nr() to help convert sectors to block numbers.
This fixes an integer overflow in the SCSI conversion layer, and it's
slightly less typing than opencoding it.
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Acked-by: Keith Busch <keith.busch@intel.com>
Diffstat (limited to 'drivers/block/nvme-scsi.c')
-rw-r--r-- | drivers/block/nvme-scsi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/nvme-scsi.c b/drivers/block/nvme-scsi.c index 483af35..db7052e 100644 --- a/drivers/block/nvme-scsi.c +++ b/drivers/block/nvme-scsi.c @@ -2040,7 +2040,7 @@ static int nvme_trans_do_nvme_io(struct nvme_ns *ns, struct sg_io_hdr *hdr, struct nvme_command c; u8 opcode = (is_write ? nvme_cmd_write : nvme_cmd_read); u16 control; - u32 max_blocks = (dev->max_hw_sectors << 9) >> ns->lba_shift; + u32 max_blocks = nvme_block_nr(ns, dev->max_hw_sectors); num_cmds = nvme_trans_io_get_num_cmds(hdr, cdb_info, max_blocks); |