From patchwork Wed May 10 15:20:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Monakhov X-Patchwork-Id: 9720069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2830A60236 for ; Wed, 10 May 2017 15:21:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B61028608 for ; Wed, 10 May 2017 15:21:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1032328613; Wed, 10 May 2017 15:21:35 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 9987228608 for ; Wed, 10 May 2017 15:21:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753690AbdEJPVd (ORCPT ); Wed, 10 May 2017 11:21:33 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33896 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753539AbdEJPVG (ORCPT ); Wed, 10 May 2017 11:21:06 -0400 Received: by mail-wm0-f68.google.com with SMTP id d127so537066wmf.1; Wed, 10 May 2017 08:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=RATeuNtSimUvdtVhb1ZL/8NNEXfBb5pCKsy+xvZqic8=; b=h7KYJUCpf1iHHtHX224drdKGUw5lgErzSgT6uZ70lqVFGlzFlRIRuBPmlcRoGolZvu QuNG+Vg+OytJRGTrikb0/PIhskmsQUXXpfFbgE51UomdMXPu0b7iSfi+9aNu8TMsEAtJ 6bZzJ3QESPiPttns0tDVsngPpylbWs25xDvxT9vkU7kYgSXUtw/YOE5HOS/6otdrv6Hu 3MgYYKLMw8OJMgfoi0a/Y87iAS43nau5PS5ZXwEAGnY5OjtfOi1HNChKEW9GEy9GjlKV CYpj1eXFghMB3y7wXk4ZMJF2H6OWVSmyNzni1rTLr0dac7L3Ab6m7gnmyWfVa0XVZUiC XxiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=RATeuNtSimUvdtVhb1ZL/8NNEXfBb5pCKsy+xvZqic8=; b=Prx5H+mp3ZtcHenIF14ZFaL49XUcE6pLxwCM9RrYOzsEzabMA7VU00No5xescwYGtE UHdqZabEHy6XcfJMlt3AGubK6V6auZakyoRWfUeVviUI649yK65DTg6xpayXeCFw/zAY AHgHNFF4GPCa7yDogS5YRFme0nhyrYtP1q0l7sj73OJLhnIvJkKIOruv67vjU7OotXlf QRelOQg1HsT6O2kBrRczLm8Ac6iExT8T8o0R+LAXHzksp6d8ie7cWcQkTVYiEacw9uMA D0wR5uRFoyPm7jqsrMUC9A2fCoTPfwlr6EAaeCPfq2laGVRglS14DyAzLAF1kEpRvlhx 63Nw== X-Gm-Message-State: AODbwcCp1W/z/Hs0m1rJeJ8yYw6istPDU32sSt6H5eh/W0yTJfjkKC4P w2rRKmg8KHmLSNlagUk= X-Received: by 10.25.201.18 with SMTP id z18mr3177746lff.66.1494429664522; Wed, 10 May 2017 08:21:04 -0700 (PDT) Received: from smtp.gmail.com (msk-vpn.virtuozzo.com. [195.214.232.6]) by smtp.gmail.com with ESMTPSA id u21sm602427lja.64.2017.05.10.08.21.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 May 2017 08:21:03 -0700 (PDT) From: Dmitry Monakhov To: fstests@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, Dmitry Monakhov Subject: [PATCH 6/9] T10: Move opencoded contants to common header Date: Wed, 10 May 2017 19:20:49 +0400 Message-Id: <1494429652-9488-7-git-send-email-dmonakhov@openvz.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1494429652-9488-1-git-send-email-dmonakhov@openvz.org> References: <1494429652-9488-1-git-send-email-dmonakhov@openvz.org> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Dmitry Monakhov Reviewed-by: Martin K. Petersen Reviewed-by: Christoph Hellwig --- block/t10-pi.c | 9 +++------ drivers/scsi/lpfc/lpfc_scsi.c | 5 +++-- drivers/scsi/qla2xxx/qla_isr.c | 8 ++++---- drivers/target/target_core_sbc.c | 2 +- include/linux/t10-pi.h | 2 ++ 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/block/t10-pi.c b/block/t10-pi.c index 680c6d6..bb099f2 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -28,9 +28,6 @@ typedef __be16 (csum_fn) (void *, unsigned int); -static const __be16 APP_ESCAPE = (__force __be16) 0xffff; -static const __be32 REF_ESCAPE = (__force __be32) 0xffffffff; - static __be16 t10_pi_crc_fn(void *data, unsigned int len) { return cpu_to_be16(crc_t10dif(data, len)); @@ -82,7 +79,7 @@ static int t10_pi_verify(struct blk_integrity_iter *iter, csum_fn *fn, switch (type) { case 1: case 2: - if (pi->app_tag == APP_ESCAPE) + if (pi->app_tag == T10_PI_APP_ESCAPE) goto next; if (be32_to_cpu(pi->ref_tag) != @@ -95,8 +92,8 @@ static int t10_pi_verify(struct blk_integrity_iter *iter, csum_fn *fn, } break; case 3: - if (pi->app_tag == APP_ESCAPE && - pi->ref_tag == REF_ESCAPE) + if (pi->app_tag == T10_PI_APP_ESCAPE && + pi->ref_tag == T10_PI_REF_ESCAPE) goto next; break; } diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 54fd0c8..99d2e99 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -2934,8 +2935,8 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) * First check to see if a protection data * check is valid */ - if ((src->ref_tag == 0xffffffff) || - (src->app_tag == 0xffff)) { + if ((src->ref_tag == T10_PI_REF_ESCAPE) || + (src->app_tag == T10_PI_APP_ESCAPE)) { start_ref_tag++; goto skipit; } diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index aac0350..7fa1712 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1950,9 +1950,9 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) * For type 3: ref & app tag is all 'f's * For type 0,1,2: app tag is all 'f's */ - if ((a_app_tag == 0xffff) && + if ((a_app_tag == T10_PI_APP_ESCAPE) && ((scsi_get_prot_type(cmd) != SCSI_PROT_DIF_TYPE3) || - (a_ref_tag == 0xffffffff))) { + (a_ref_tag == T10_PI_REF_ESCAPE))) { uint32_t blocks_done, resid; sector_t lba_s = scsi_get_lba(cmd); @@ -1994,9 +1994,9 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) spt = page_address(sg_page(sg)) + sg->offset; spt += j; - spt->app_tag = 0xffff; + spt->app_tag = T10_PI_APP_ESCAPE; if (scsi_get_prot_type(cmd) == SCSI_PROT_DIF_TYPE3) - spt->ref_tag = 0xffffffff; + spt->ref_tag = T10_PI_REF_ESCAPE; } return 0; diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index a0ad618..d542a12 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c @@ -1504,7 +1504,7 @@ sbc_dif_verify(struct se_cmd *cmd, sector_t start, unsigned int sectors, (unsigned long long)sector, sdt->guard_tag, sdt->app_tag, be32_to_cpu(sdt->ref_tag)); - if (sdt->app_tag == cpu_to_be16(0xffff)) { + if (sdt->app_tag == T10_PI_APP_ESCAPE) { dsg_off += block_size; goto next; } diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h index 9375d23..635a3c5 100644 --- a/include/linux/t10-pi.h +++ b/include/linux/t10-pi.h @@ -33,6 +33,8 @@ struct t10_pi_tuple { __be32 ref_tag; /* Target LBA or indirect LBA */ }; +#define T10_PI_APP_ESCAPE cpu_to_be16(0xffff) +#define T10_PI_REF_ESCAPE cpu_to_be32(0xffffffff) extern const struct blk_integrity_profile t10_pi_type1_crc; extern const struct blk_integrity_profile t10_pi_type1_ip;