From patchwork Tue Jul 31 07:19:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Dongyang X-Patchwork-Id: 10550305 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 4308196FA for ; Tue, 31 Jul 2018 07:25:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27CFA205A9 for ; Tue, 31 Jul 2018 07:25:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BB0029795; Tue, 31 Jul 2018 07:25:56 +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=ham 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 9ECAD205A9 for ; Tue, 31 Jul 2018 07:25:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729960AbeGaJEu (ORCPT ); Tue, 31 Jul 2018 05:04:50 -0400 Received: from mail2-drop-p3.anu.edu.au ([130.56.64.39]:51038 "EHLO mail2-drop-p3.anu.edu.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729784AbeGaJEu (ORCPT ); Tue, 31 Jul 2018 05:04:50 -0400 X-Greylist: delayed 346 seconds by postgrey-1.27 at vger.kernel.org; Tue, 31 Jul 2018 05:04:47 EDT Received: from mailpmx1.anu.edu.au (snatpool01-3.anu.edu.au [130.56.66.107]) by mail2-drop-p3.anu.edu.au (8.14.7/8.14.7) with ESMTP id w6V7JrWs100447; Tue, 31 Jul 2018 17:19:53 +1000 Received: from mailpmx1.anu.edu.au (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 8E9B980BF6; Tue, 31 Jul 2018 17:19:53 +1000 (AEST) Received: from smtphost.anu.edu.au (snatpool01-3.anu.edu.au [130.56.66.107]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mailpmx1.anu.edu.au (Postfix) with ESMTPS id 9469B80B2A; Tue, 31 Jul 2018 17:19:52 +1000 (AEST) Received: from X1C6.localdomain ([103.93.68.4]) (authenticated bits=0) by smtphost.anu.edu.au (8.13.8/8.13.8) with ESMTP id w6V7JcfI010398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 Jul 2018 17:19:52 +1000 From: Li Dongyang To: linux-block@vger.kernel.org Cc: adilger@dilger.ca, lixi@ddn.com, martin.petersen@oracle.com, sihara@ddn.com Subject: [PATCH 2/2] block: pass bio into integrity_processing_fn Date: Tue, 31 Jul 2018 17:19:38 +1000 Message-Id: <20180731071938.22129-2-dongyangli@ddn.com> X-Mailer: git-send-email 2.18.0 X-PMX-Version: 6.4.4.2767743, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2018.7.31.71515, AntiVirus-Engine: 5.52.0, AntiVirus-Data: 2018.7.31.5520000 internal X-OriginatorOrg: anu.edu.au X-PMX-Info: authenticated X-PerlMx-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_4000_4999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, LEGITIMATE_SIGNS 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, RDNS_NXDOMAIN 0, RDNS_SUSP 0, RDNS_SUSP_GENERIC 0, SPF_UNKNOWN 0, __ANY_URI 0, __FROM_DOMAIN_IN_ANY_CC1 0, __FROM_DOMAIN_IN_RCPT 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MULTIPLE_RCPTS_CC_X2 0, __NO_HTML_TAG_RAW 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' 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 Having struct bio allows us to do more in the genrate/verify_fn, like copying a knwon good guard tag already available rather than calculating it. Signed-off-by: Li Xi Signed-off-by: Li Dongyang --- block/bio-integrity.c | 2 +- block/blk-integrity.c | 3 ++- block/t10-pi.c | 24 ++++++++++++++++-------- include/linux/blkdev.h | 3 ++- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 1b280784671d..79c77984a2ac 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -214,7 +214,7 @@ static blk_status_t bio_integrity_process(struct bio *bio, iter.data_buf = kaddr + bv.bv_offset; iter.data_size = bv.bv_len; - ret = proc_fn(&iter); + ret = proc_fn(bio, &iter); if (ret) { kunmap_atomic(kaddr); return ret; diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 6121611e1316..8207dd7f3fe3 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -384,7 +384,8 @@ static struct kobj_type integrity_ktype = { .sysfs_ops = &integrity_ops, }; -static blk_status_t blk_integrity_nop_fn(struct blk_integrity_iter *iter) +static blk_status_t blk_integrity_nop_fn(struct bio *bio, + struct blk_integrity_iter *iter) { return BLK_STS_OK; } diff --git a/block/t10-pi.c b/block/t10-pi.c index a98db384048f..c409f33a54bc 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -117,42 +117,50 @@ static blk_status_t t10_pi_verify(struct blk_integrity_iter *iter, return BLK_STS_OK; } -static blk_status_t t10_pi_type1_generate_crc(struct blk_integrity_iter *iter) +static blk_status_t t10_pi_type1_generate_crc(struct bio *bio, + struct blk_integrity_iter *iter) { return t10_pi_generate(iter, t10_pi_crc_fn, 1); } -static blk_status_t t10_pi_type1_generate_ip(struct blk_integrity_iter *iter) +static blk_status_t t10_pi_type1_generate_ip(struct bio *bio, + struct blk_integrity_iter *iter) { return t10_pi_generate(iter, t10_pi_ip_fn, 1); } -static blk_status_t t10_pi_type1_verify_crc(struct blk_integrity_iter *iter) +static blk_status_t t10_pi_type1_verify_crc(struct bio *bio, + struct blk_integrity_iter *iter) { return t10_pi_verify(iter, t10_pi_crc_fn, 1); } -static blk_status_t t10_pi_type1_verify_ip(struct blk_integrity_iter *iter) +static blk_status_t t10_pi_type1_verify_ip(struct bio *bio, + struct blk_integrity_iter *iter) { return t10_pi_verify(iter, t10_pi_ip_fn, 1); } -static blk_status_t t10_pi_type3_generate_crc(struct blk_integrity_iter *iter) +static blk_status_t t10_pi_type3_generate_crc(struct bio *bio, + struct blk_integrity_iter *iter) { return t10_pi_generate(iter, t10_pi_crc_fn, 3); } -static blk_status_t t10_pi_type3_generate_ip(struct blk_integrity_iter *iter) +static blk_status_t t10_pi_type3_generate_ip(struct bio *bio, + struct blk_integrity_iter *iter) { return t10_pi_generate(iter, t10_pi_ip_fn, 3); } -static blk_status_t t10_pi_type3_verify_crc(struct blk_integrity_iter *iter) +static blk_status_t t10_pi_type3_verify_crc(struct bio *bio, + struct blk_integrity_iter *iter) { return t10_pi_verify(iter, t10_pi_crc_fn, 3); } -static blk_status_t t10_pi_type3_verify_ip(struct blk_integrity_iter *iter) +static blk_status_t t10_pi_type3_verify_ip(struct bio *bio, + struct blk_integrity_iter *iter) { return t10_pi_verify(iter, t10_pi_ip_fn, 3); } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 79226ca8f80f..1be4e3a69e81 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1805,7 +1805,8 @@ struct blk_integrity_iter { const char *disk_name; }; -typedef blk_status_t (integrity_processing_fn) (struct blk_integrity_iter *); +typedef blk_status_t (integrity_processing_fn) (struct bio *, + struct blk_integrity_iter *); struct blk_integrity_profile { integrity_processing_fn *generate_fn;