From patchwork Sat Jan 30 07:05:49 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: 8169861 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 74BDDBEEE5 for ; Sat, 30 Jan 2016 07:09:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92F8120395 for ; Sat, 30 Jan 2016 07:09:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A0B7E20397 for ; Sat, 30 Jan 2016 07:09:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756430AbcA3HI6 (ORCPT ); Sat, 30 Jan 2016 02:08:58 -0500 Received: from mail-ob0-f180.google.com ([209.85.214.180]:34845 "EHLO mail-ob0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756335AbcA3HIz (ORCPT ); Sat, 30 Jan 2016 02:08:55 -0500 Received: by mail-ob0-f180.google.com with SMTP id ny8so59663557obc.2 for ; Fri, 29 Jan 2016 23:08:55 -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=4u8118mpQTqgzlfKSos9FsfzvBDLgPukN4eiFNIzXd0=; b=auDBCAopWAFdLqIAs2/0dTTpFJ/le8xRml/VKWV4jAIWQeNWuKpWlolbmJtbKy8ZvL WVynljDEZW3xycwDkzj8Sts8naqCyL9sX24B7gASjiv5Jxnm3FBCX3H8bRpzoPIlnkTJ 3rKzR4HFLnr9jQP3qCEgahYwSeyNH/PDoDbBMD3XVJDcEO8EtewU3gbA/Fcn1pZNUr8y Z9ZYdpb5OeaY8eRVSVXHVlgo4Hcv5bY1WNOY0noDySki0k62IQZQAB7crPLKhVgqJBYO IhtWOYCYjrdYWSMpD7gyMSNuj/qoatGDRaAQ1zfNgzqEQfk4nSzjZ9lJzRP9GAEHgwgz 04xA== 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=4u8118mpQTqgzlfKSos9FsfzvBDLgPukN4eiFNIzXd0=; b=d8b4XYwFlful+tfoa31uWZP72JefQprvSN8VjbQ6BvS4b6uJEXHTwwNzckflS9TphG EZOy3yXZpp7UBcJ7i7V1vgE7MEmzoEecupG6VEqAAc+meC/hqlRizyaq9cJ/Nlm3yv66 IpCMJkPnX/y4aqb7v3rJmV+P2AGQxYY+0P6puXqrx/Xzhgd2aRxDuea3aMkrkKA6vPWr 9A/HD1rvFa9jc2IiyXacGRU5zhK3IwMGPuk59LfmWPZkOopyFSTnNidHEhOeQndjuFvM muwtOp/Hixtpn4MKdshirkQzyf3RarA8l9M0Tyy6FBPE/4+b6GqGMNmqVv+LRb9Zbn3u iQnA== X-Gm-Message-State: AG10YOR6qC6TyswLQKXItWbfN4pZFrucj071e669DUzumOresN8B/3HRlVHwyne7QVsSRg== X-Received: by 10.60.232.99 with SMTP id tn3mr5616211oec.8.1454137734863; Fri, 29 Jan 2016 23:08:54 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id f8sm8655678obs.3.2016.01.29.23.08.53 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 29 Jan 2016 23:08:54 -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 , Nicholas Bellinger , Vasu Dev Subject: [PATCH-v3 05/14] tcm_fc: Convert to target_alloc_session usage Date: Sat, 30 Jan 2016 07:05:49 +0000 Message-Id: <1454137558-30396-6-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1454137558-30396-1-git-send-email-nab@daterainc.com> References: <1454137558-30396-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 Cc: Vasu Dev 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; }