From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Greg Edwards <gedwards@ddn.com>
Cc: <linux-block@vger.kernel.org>, <linux-scsi@vger.kernel.org>,
Jens Axboe <axboe@kernel.dk>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: Re: [PATCH 2/2] scsi: virtio_scsi: fix pi_bytes{out,in} on 4 KiB block size devices
Date: Wed, 25 Jul 2018 21:46:07 -0400 [thread overview]
Message-ID: <yq1zhye22hs.fsf@oracle.com> (raw)
In-Reply-To: <20180725142259.20562-3-gedwards@ddn.com> (Greg Edwards's message of "Wed, 25 Jul 2018 10:22:59 -0400")
Greg,
> The current calculation for pi_bytes{out,in} assumes a 512 byte logical
> block size and a protection interval exponent of 0, i.e. 512 bytes data
> + 8 bytes PI.
The block layer always deals with units of 512 bytes. Regardless of the
underlying logical block size.
> When run on a 4 KiB logical block size device with a protection
> interval exponent of 0, i.e. 4096 bytes data + 8 bytes PI, the driver
> miscalculates the pi_bytes{out,in} by a factor of 8x (64 bytes).
> @@ -513,12 +513,12 @@ static void virtio_scsi_init_hdr_pi(struct virtio_device *vdev,
>
> if (sc->sc_data_direction == DMA_TO_DEVICE)
> cmd_pi->pi_bytesout = cpu_to_virtio32(vdev,
> - blk_rq_sectors(rq) *
> - bi->tuple_size);
> + bio_integrity_bytes(bi,
> + blk_rq_sectors(rq)));
The formatting/alignment could be improved here. Otherwise OK.
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen Oracle Linux Engineering
next prev parent reply other threads:[~2018-07-26 1:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-25 14:22 [PATCH 0/2] virtio_scsi pi_bytes{out,in} miscalculated on 4 KiB devices Greg Edwards
2018-07-25 14:22 ` [PATCH 1/2] block: move bio_integrity_{intervals,bytes} into blkdev.h Greg Edwards
2018-07-26 1:39 ` Martin K. Petersen
2018-07-25 14:22 ` [PATCH 2/2] scsi: virtio_scsi: fix pi_bytes{out,in} on 4 KiB block size devices Greg Edwards
2018-07-26 1:46 ` Martin K. Petersen [this message]
2018-07-26 19:52 ` [PATCH v2] " Greg Edwards
2018-07-26 21:49 ` [PATCH 0/2] virtio_scsi pi_bytes{out,in} miscalculated on 4 KiB devices Jens Axboe
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=yq1zhye22hs.fsf@oracle.com \
--to=martin.petersen@oracle.com \
--cc=axboe@kernel.dk \
--cc=gedwards@ddn.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.