From patchwork Tue May 5 09:56:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 6336641 Return-Path: X-Original-To: patchwork-ceph-devel@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 D9847BEEE1 for ; Tue, 5 May 2015 09:56:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C8182034F for ; Tue, 5 May 2015 09:56:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 18CDE2034B for ; Tue, 5 May 2015 09:56:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757360AbbEEJ4j (ORCPT ); Tue, 5 May 2015 05:56:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57267 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757346AbbEEJ4Y (ORCPT ); Tue, 5 May 2015 05:56:24 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id ED86891761; Tue, 5 May 2015 09:56:23 +0000 (UTC) Received: from rh2.redhat.com (vpn-61-140.rdu2.redhat.com [10.10.61.140]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t459uKw5026364; Tue, 5 May 2015 05:56:23 -0400 From: mchristi@redhat.com To: ceph-devel@vger.kernel.org, target-devel@vger.kernel.org Subject: [PATCH 3/5] target: lun reset cluster hook into support Date: Tue, 5 May 2015 04:56:16 -0500 Message-Id: <1430819778-24483-4-git-send-email-mchristi@redhat.com> In-Reply-To: <1430819778-24483-1-git-send-email-mchristi@redhat.com> References: <1430819778-24483-1-git-send-email-mchristi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 From: Mike Christie This patch allows a module to hook into the lun reset support. Signed-off-by: Mike Christie --- drivers/target/target_core_tmr.c | 18 ++++++++++++++++-- include/target/target_core_fabric.h | 3 +++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index fa5e157..fdaa391 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "target_core_internal.h" @@ -323,7 +324,7 @@ static void core_tmr_drain_state_list( } } -int core_tmr_lun_reset( +int target_local_tmr_lun_reset( struct se_device *dev, struct se_tmr_req *tmr, struct list_head *preempt_and_abort_list, @@ -380,10 +381,23 @@ int core_tmr_lun_reset( } atomic_long_inc(&dev->num_resets); - pr_debug("LUN_RESET: %s for [%s] Complete\n", (preempt_and_abort_list) ? "Preempt" : "TMR", dev->transport->name); return 0; } +EXPORT_SYMBOL(target_local_tmr_lun_reset); +int core_tmr_lun_reset( + struct se_device *dev, + struct se_tmr_req *tmr, + struct list_head *preempt_and_abort_list, + struct se_cmd *prout_cmd) +{ + if (dev->cluster_api) + return dev->cluster_api->reset_device(dev, 0); + else + return target_local_tmr_lun_reset(dev, tmr, + preempt_and_abort_list, + prout_cmd); +} diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 22a4e98e..36fc3ac 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -133,6 +133,9 @@ void target_wait_for_sess_cmds(struct se_session *); int core_alua_check_nonop_delay(struct se_cmd *); + +int target_local_tmr_lun_reset(struct se_device *, struct se_tmr_req *, + struct list_head *, struct se_cmd *); int core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); void core_tmr_release_req(struct se_tmr_req *); int transport_generic_handle_tmr(struct se_cmd *);