From: Rodrigo R. Galvao Date: Thu, 12 Apr 2018 15:16:11 +0000 (-0600) Subject: nvmet: Fix nvmet_execute_write_zeroes sector count X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=543c09c89fdc007c2990aa9d2abcc62e0dfa1311;p=openwrt%2Fstaging%2Fblogic.git 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 [changelog] Signed-off-by: Keith Busch Signed-off-by: Jens Axboe --- 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))