diff options
author | Keith Busch <kbusch@kernel.org> | 2020-04-03 18:24:01 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-05-10 00:18:34 +0200 |
commit | 71fb90eb71d76089115aedf942533bcb3fd5c7f9 (patch) | |
tree | a8e63f24789765ee0983d6e5c71f69922987a979 /drivers/nvme/host/nvme.h | |
parent | lpfc: nvmet: Add Send LS Request and Abort LS Request support (diff) | |
download | linux-71fb90eb71d76089115aedf942533bcb3fd5c7f9.tar.xz linux-71fb90eb71d76089115aedf942533bcb3fd5c7f9.zip |
nvme: provide num dword helper
Various nvme commands use a zeroes based number of dwords field. Create
a helper function to convert byte lengths to this format.
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/nvme/host/nvme.h')
-rw-r--r-- | drivers/nvme/host/nvme.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 2e04a36296d9..36f44b79bb3b 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -449,6 +449,14 @@ static inline sector_t nvme_lba_to_sect(struct nvme_ns *ns, u64 lba) return lba << (ns->lba_shift - SECTOR_SHIFT); } +/* + * Convert byte length to nvme's 0-based num dwords + */ +static inline u32 nvme_bytes_to_numd(size_t len) +{ + return (len >> 2) - 1; +} + static inline void nvme_end_request(struct request *req, __le16 status, union nvme_result result) { |