From patchwork Fri Mar 11 06:30:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 8562331 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5E35C9F6E4 for ; Fri, 11 Mar 2016 06:34:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 624982026D for ; Fri, 11 Mar 2016 06:34:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FAF82035E for ; Fri, 11 Mar 2016 06:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932520AbcCKGel (ORCPT ); Fri, 11 Mar 2016 01:34:41 -0500 Received: from mail-oi0-f52.google.com ([209.85.218.52]:33593 "EHLO mail-oi0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754495AbcCKGeh (ORCPT ); Fri, 11 Mar 2016 01:34:37 -0500 Received: by mail-oi0-f52.google.com with SMTP id d205so79020015oia.0 for ; Thu, 10 Mar 2016 22:34:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daterainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BL/EvJmyzSaKVIBOoJ8ucAA71iWflpeD/t9yDcdQU0w=; b=PauZ0xM3N5KDVsOTk4GJ56pQhupNY9//L+71X2TjZ3VKL9bbB3QFhViz/HSN8WLbT0 pbYMK1BrKWzGRfoxbYjFVi4ExMlT1mo8kudajZr9jwWIQAqe/Y+3eEzp7HNG0bZ4DirQ ShwErKy1HQJDPqsqa3a0Gfz+58x5RM6KpMRVvsIh6TAf7oUssGEQ14FEMJQnC/Lf88V7 JAxz1fvTLSh7rW3Md2aGqm4D3CmPFgrRttzEdvOvWVhxMWPDIabeA1GFEn55wSGAoRS+ G4DqVjc3vUEkyvluukBehO9Y+Ms/vFEIJ2mY+/284Pn1owetr3ArdxrFslJ4ZOiHz8Ys GdlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BL/EvJmyzSaKVIBOoJ8ucAA71iWflpeD/t9yDcdQU0w=; b=Xw6U60x4txselQl7lHBPADpAFE4RbscsnIYGaLJrKe5UvetMaabay5flOoYgKuMkXk BpECFTKr6DW3315kGHou0VH4j9uCMFU8hJjTGLnURoVAaC1lmsThpyK96Q0OWDbdOeCQ inX7ENuDzTE58VwU8YmvF/qn47mEedvNglhq6MrnRYnc5aXGpyfGVrPLPcm2s2dlJrnO p+IbqAcL+JU8Rrlm2khL9mUArL3wkShMLBnz5bsC2OUadzmLjAsNE0hIg1FX/pUCLljE Ki4E6nA+adkHSlxcKp7+sXiBZ67Ebkp5Z8zZibF38vyD6+1r5WbrN9QErXqBXBgPICe6 VEQg== X-Gm-Message-State: AD7BkJJb1TdNhTBYTUX0OqeSDT+caTBojspLXPEW6cGtfX+nTyjRq2h2szI/XPPXkJVm1Q== X-Received: by 10.202.196.149 with SMTP id u143mr4294273oif.10.1457678076358; Thu, 10 Mar 2016 22:34:36 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id s81sm3540631oif.0.2016.03.10.22.34.35 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 Mar 2016 22:34:35 -0800 (PST) From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , Christoph Hellwig , Hannes Reinecke , Mike Christie , Sagi Grimberg , Andy Grover , Sebastian Andrzej Siewior , Juergen Gross , Andrzej Pietrasiewicz , Chris Boot , Felipe Balbi , Nicholas Bellinger , Vasu Dev , Mark Rustad , Robert Love Subject: [PATCH-v4 05/14] tcm_fc: Convert to target_alloc_session usage Date: Fri, 11 Mar 2016 06:30:01 +0000 Message-Id: <1457677810-2478-6-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1457677810-2478-1-git-send-email-nab@daterainc.com> References: <1457677810-2478-1-git-send-email-nab@daterainc.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=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 From: Nicholas Bellinger This patch converts tcm_fc target mode addition of tf_sess->hash to port_id hlist_head using the new alloc_session callback(). Cc: Vasu Dev Cc: Mark Rustad Cc: Robert Love Signed-off-by: Nicholas Bellinger --- drivers/target/tcm_fc/tfc_sess.c | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c index e19f4c5..d0c3e18 100644 --- a/drivers/target/tcm_fc/tfc_sess.c +++ b/drivers/target/tcm_fc/tfc_sess.c @@ -186,6 +186,20 @@ out: return NULL; } +static int ft_sess_alloc_cb(struct se_portal_group *se_tpg, + struct se_session *se_sess, void *p) +{ + struct ft_sess *sess = p; + struct ft_tport *tport = sess->tport; + struct hlist_head *head = &tport->hash[ft_sess_hash(sess->port_id)]; + + pr_debug("port_id %x sess %p\n", sess->port_id, sess); + hlist_add_head_rcu(&sess->hash, head); + tport->sess_count++; + + return 0; +} + /* * Allocate session and enter it in the hash for the local port. * Caller holds ft_lport_lock. @@ -194,7 +208,6 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id, struct fc_rport_priv *rdata) { struct se_portal_group *se_tpg = &tport->tpg->se_tpg; - struct se_node_acl *se_acl; struct ft_sess *sess; struct hlist_head *head; unsigned char initiatorname[TRANSPORT_IQN_LEN]; @@ -210,31 +223,18 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id, if (!sess) return NULL; - sess->se_sess = transport_init_session_tags(TCM_FC_DEFAULT_TAGS, - sizeof(struct ft_cmd), - TARGET_PROT_NORMAL); - if (IS_ERR(sess->se_sess)) { - kfree(sess); - return NULL; - } + kref_init(&sess->kref); /* ref for table entry */ + sess->tport = tport; + sess->port_id = port_id; - se_acl = core_tpg_get_initiator_node_acl(se_tpg, &initiatorname[0]); - if (!se_acl) { - transport_free_session(sess->se_sess); + sess->se_sess = target_alloc_session(se_tpg, TCM_FC_DEFAULT_TAGS, + sizeof(struct ft_cmd), + TARGET_PROT_NORMAL, &initiatorname[0], + sess, ft_sess_alloc_cb); + if (IS_ERR(sess->se_sess)) { kfree(sess); return NULL; } - sess->se_sess->se_node_acl = se_acl; - sess->tport = tport; - sess->port_id = port_id; - kref_init(&sess->kref); /* ref for table entry */ - hlist_add_head_rcu(&sess->hash, head); - tport->sess_count++; - - pr_debug("port_id %x sess %p\n", port_id, sess); - - transport_register_session(&tport->tpg->se_tpg, se_acl, - sess->se_sess, sess); return sess; }