From patchwork Tue Jul 7 06:18:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 6730181 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0E336C05AC for ; Tue, 7 Jul 2015 06:18:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DCE222054B for ; Tue, 7 Jul 2015 06:18:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C444E20549 for ; Tue, 7 Jul 2015 06:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752071AbbGGGSF (ORCPT ); Tue, 7 Jul 2015 02:18:05 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:36924 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751571AbbGGGSD (ORCPT ); Tue, 7 Jul 2015 02:18:03 -0400 Received: by wiclp1 with SMTP id lp1so40066047wic.0 for ; Mon, 06 Jul 2015 23:18:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=1XyZTCfzm7dAEoSF8K2UAq3DqPU4dcLUI03HYJiPnsQ=; b=YMaaLI53H+vo1GSAFI0u/z2fuPDLSIIcm0Y38kNQsG87kiMYpyHnn9srcvlHf2Qpgt 7Ekc0d//dFjE8A6bOVgkyQpbhjuQ7TCWzQlfw0VKHcOq8RmOk1020k5bcK82lhtc4VgO tbLZjHJxmVkbpMGakiG4qVjiW4JIVwtdmuxMWI+ZNv6r7VR/2DWp5jjq525p/B/APjeG UREryHsN/1PqzI6HZ9678w0QOPpPgCzyU3m+rj6QIJk5X65HGo4nyfJ7qUeRiTF8bq0y +zeVs2wdQqN0iY0bkV1qVCh4fa1tCA3xSIRZI0HLAls/wu9Tivk/rKET4/f34sHPMkMM UJ0Q== X-Gm-Message-State: ALoCoQl2su0kxgZ7mTNnukVDN/gYlUIxUtofBMonWcZC/zKk7le1696DJTo20gdTQlnMf6HsCaTq X-Received: by 10.180.109.6 with SMTP id ho6mr99755371wib.58.1436249881798; Mon, 06 Jul 2015 23:18:01 -0700 (PDT) Received: from [10.223.0.123] ([193.47.165.251]) by mx.google.com with ESMTPSA id x10sm31634640wjr.25.2015.07.06.23.18.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 23:18:01 -0700 (PDT) Subject: Re: [PATCH v3 0/5] Target sense data handling modifications To: "Nicholas A. Bellinger" , Sagi Grimberg References: <1436188508-1539-1-git-send-email-sagig@mellanox.com> <1436223065.6666.7.camel@haakon3.risingtidesystems.com> Cc: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, Bart Van Assche , Christoph Hellwig , Hannes Reinecke From: Sagi Grimberg Message-ID: <559B6F26.7050006@dev.mellanox.co.il> Date: Tue, 7 Jul 2015 09:18:14 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <1436223065.6666.7.camel@haakon3.risingtidesystems.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 7/7/2015 1:51 AM, Nicholas A. Bellinger wrote: > On Mon, 2015-07-06 at 16:15 +0300, Sagi Grimberg wrote: >> This patch set modifies the target sense data handling. >> First, cleanup transport_send_check_condition_and_sense() >> by splitting the sense translation to a separate function. >> Second, convert sense reason the switch statement to a table >> driven code. Third, Use scsi common helpers to correctly set >> the sense buffer. Last, Fix wrong setting of t10-pi errors >> (non descriptor format). >> >> Changes from v2: >> - Pass sense_reason_t to scsi_translate_sense() >> - Split patch 3: >> 1) move the helpers to scsi_common.c >> 2) use helpers in the target code >> 3) always use descriptor-type sense data for PI errors >> >> Changes from v1: >> - Added Reviewed-by tags for patches 1,2 >> - Fixed compilation error after testing patch #3 on scsi/for-next >> branch. Moved scsi_sense_desc_find() to scsi_common as well (dependency) >> and also moved include to scsi_common.h >> >> Changes from v0: >> - Added Bart's patches and converted my patch to apply over his >> - Moved scsi sense helpers to scsi_common >> >> Bart Van Assche (2): >> target: Inline transport_get_sense_codes() >> target: Split transport_send_check_condition_and_sense() >> >> Sagi Grimberg (3): >> scsi: Move sense handling routines to scsi_common >> target: Use scsi helpers to build the sense data correctly >> target: Fix wrong setting of sense format for PI errors >> >> drivers/scsi/scsi_common.c | 98 ++++++++ >> drivers/scsi/scsi_error.c | 99 +------- >> drivers/target/target_core_spc.c | 31 +-- >> drivers/target/target_core_transport.c | 399 ++++++++++++--------------------- >> include/scsi/scsi_common.h | 5 + >> include/scsi/scsi_eh.h | 7 +- >> include/target/target_core_base.h | 1 + >> 7 files changed, 256 insertions(+), 384 deletions(-) >> > > Nice series to make scsi-core and target-core use common code. ;) > > Applied to target-pending/for-next. > > hch + jejb, please let me know if you have any objections to taking this > through target-pending. Can you please fold into patch #5 this change suggested by Bart: }, [TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE] = { /* --- Thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 79bb8d1..9c34937 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2625,7 +2625,7 @@ struct sense_info { u8 asc; u8 ascq; bool add_sector_info; - int desc_format; + bool desc_format; }; static const struct sense_info sense_info_table[] = { @@ -2709,21 +2709,21 @@ static const struct sense_info sense_info_table[] = { .asc = 0x10, .ascq = 0x01, /* LOGICAL BLOCK GUARD CHECK FAILED */ .add_sector_info = true, - .desc_format = 1, + .desc_format = true, }, [TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED] = { .key = ILLEGAL_REQUEST, .asc = 0x10, .ascq = 0x02, /* LOGICAL BLOCK APPLICATION TAG CHECK FAILED */ .add_sector_info = true, - .desc_format = 1, + .desc_format = true, }, [TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED] = { .key = ILLEGAL_REQUEST, .asc = 0x10, .ascq = 0x03, /* LOGICAL BLOCK REFERENCE TAG CHECK FAILED */ .add_sector_info = true, - .desc_format = 1, + .desc_format = true,