summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRodrigo R. Galvao <rosattig@linux.vnet.ibm.com>2018-04-12 18:16:11 +0300
committerJens Axboe <axboe@kernel.dk>2018-04-12 18:58:27 +0300
commit543c09c89fdc007c2990aa9d2abcc62e0dfa1311 (patch)
treef015c73f3222a87bebda4608b18be8fc09d8b159 /drivers
parent22b5560195bd66bc43359b71821dc78cc9de56c6 (diff)
downloadlinux-543c09c89fdc007c2990aa9d2abcc62e0dfa1311.tar.xz
nvmet: Fix nvmet_execute_write_zeroes sector count
We have to increment the number of logical blocks to a 1's based value in the native format prior to converting to 512b units. Signed-off-by: Rodrigo R. Galvao <rosattig@linux.vnet.ibm.com> [changelog] Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvme/target/io-cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvme/target/io-cmd.c b/drivers/nvme/target/io-cmd.c
index 28bbdff4a88b..cd2344179673 100644
--- a/drivers/nvme/target/io-cmd.c
+++ b/drivers/nvme/target/io-cmd.c
@@ -173,8 +173,8 @@ static void nvmet_execute_write_zeroes(struct nvmet_req *req)
sector = le64_to_cpu(write_zeroes->slba) <<
(req->ns->blksize_shift - 9);
- nr_sector = (((sector_t)le16_to_cpu(write_zeroes->length)) <<
- (req->ns->blksize_shift - 9)) + 1;
+ nr_sector = (((sector_t)le16_to_cpu(write_zeroes->length) + 1) <<
+ (req->ns->blksize_shift - 9));
if (__blkdev_issue_zeroout(req->ns->bdev, sector, nr_sector,
GFP_KERNEL, &bio, 0))