Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH] nvmet: fix nvmet_execute_write_zeroes function
Date: Mon, 2 Apr 2018 07:47:40 -0600	[thread overview]
Message-ID: <20180402134740.GB28945@localhost.localdomain> (raw)
In-Reply-To: <1522444730-2060-1-git-send-email-rosattig@linux.vnet.ibm.com>

On Fri, Mar 30, 2018@06:18:50PM -0300, Rodrigo R. Galvao wrote:
>  	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;
> +		(req->ns->blksize_shift - 9));

I see what's wrong here. The +1 needs to be on the native format prior
to converting to 512b, so the fix needs to be:

---
 	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))
--

      parent reply	other threads:[~2018-04-02 13:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-30 21:18 [PATCH] nvmet: fix nvmet_execute_write_zeroes function Rodrigo R. Galvao
2018-03-30 21:24 ` Keith Busch
2018-03-30 21:48   ` Rodrigo Rosatti Galvão
2018-04-02  8:03     ` chaitany kulkarni
2018-04-02 13:47       ` Rodrigo Rosatti Galvao
2018-04-02 14:21         ` Keith Busch
2018-04-02 14:50           ` Rodrigo Rosatti Galvao
2018-04-02 13:47 ` Keith Busch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180402134740.GB28945@localhost.localdomain \
    --to=keith.busch@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox