From patchwork Wed Jul 25 14:22:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Edwards X-Patchwork-Id: 10544091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E069184F for ; Wed, 25 Jul 2018 14:29:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B54C2A100 for ; Wed, 25 Jul 2018 14:29:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FB062A112; Wed, 25 Jul 2018 14:29:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 435A52A100 for ; Wed, 25 Jul 2018 14:29:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729044AbeGYPk6 (ORCPT ); Wed, 25 Jul 2018 11:40:58 -0400 Received: from legacy.ddn.com ([64.47.133.206]:12493 "EHLO legacy.ddn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728051AbeGYPk6 (ORCPT ); Wed, 25 Jul 2018 11:40:58 -0400 X-Greylist: delayed 325 seconds by postgrey-1.27 at vger.kernel.org; Wed, 25 Jul 2018 11:40:58 EDT Received: from LAX-EX-CAHT1.datadirect.datadirectnet.com (10.8.103.81) by LAX-EX-CAHT2.datadirect.datadirectnet.com (10.8.103.82) with Microsoft SMTP Server (TLS) id 14.3.389.1; Wed, 25 Jul 2018 07:23:38 -0700 Received: from soma.datadirect.datadirectnet.com (10.48.114.40) by LAX-EX-CAHT1.datadirect.datadirectnet.com (10.8.103.81) with Microsoft SMTP Server (TLS) id 14.3.389.1; Wed, 25 Jul 2018 07:23:37 -0700 From: Greg Edwards To: , CC: Jens Axboe , "Martin K. Petersen" , Greg Edwards Subject: [PATCH 0/2] virtio_scsi pi_bytes{out,in} miscalculated on 4 KiB devices Date: Wed, 25 Jul 2018 10:22:57 -0400 Message-ID: <20180725142259.20562-1-gedwards@ddn.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.48.114.40] Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the VIRTIO_SCSI_F_T10_PI feature bit is enabled, the virtio_scsi driver does not correctly calculate pi_bytes{out,in} when the underlying device has a 4 KiB logical block size. The current code assumes a 512 byte logical block size and protection interval exponent of 0 (512 bytes + 8 bytes PI). The first patch moves bio_integrity_intervals() and bio_integrity_bytes() into blkdev.h so drivers can make use of them. The second patch modifies virtio_scsi to call bio_integrity_bytes() to get the values for pi_bytes{out,in}. Greg Edwards (2): block: move bio_integrity_{intervals,bytes} into blkdev.h scsi: virtio_scsi: fix pi_bytes{out,in} on 4 KiB block size devices block/bio-integrity.c | 22 ---------------------- drivers/scsi/virtio_scsi.c | 8 ++++---- include/linux/blkdev.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 26 deletions(-)