From patchwork Mon Jan 25 08:10:59 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: 8104421 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 9A0F99F6DA for ; Mon, 25 Jan 2016 08:14:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91B3D20364 for ; Mon, 25 Jan 2016 08:14:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E01A2034F for ; Mon, 25 Jan 2016 08:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755508AbcAYIOW (ORCPT ); Mon, 25 Jan 2016 03:14:22 -0500 Received: from mail-oi0-f45.google.com ([209.85.218.45]:34171 "EHLO mail-oi0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752634AbcAYIN7 (ORCPT ); Mon, 25 Jan 2016 03:13:59 -0500 Received: by mail-oi0-f45.google.com with SMTP id k206so84029465oia.1 for ; Mon, 25 Jan 2016 00:13:59 -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=yAxQ+DH8QGjyznvvCZc7+qb0lN7SRPwRsI7RVFKmOyWfSpTcFnt8i7/se1LtKiGguu wFSAWcXqVtGTJUGXv4/ec51frx7LozaUvp8BoTKFmM5Qze2F28sNEgjFkQ7V9yNNo5tt Ap08L8QdeNa/wSZosfjmhb+9feugeRSR7OGhUUyJcTB/zCzk5Qc1d9N/WoZwmIx7ql+N JdkV87o8ifn868+bh3XwSPSD2GUSygx3Jg1keqXr3yvGuPUi5ab7m3P37VsamKDWBoBz KAqOQf0CES4bjSPViulOUWQlxOQx6e22lMHwrJBvfulb+P7T0sK6kAzuhSxTQ/Kbvelp jYsA== 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=jSQPRUoLu2uE2tqRz/C9LloEqtjaINYiONg3xAqNik6rW7MaGxr232f7O0Q5sJ7xhz 4LfBWjFF3J1me8mJEYhql+P9AWwDaDpj2FP1armZLwd1pOgh0ivRxGdi3w+b0FlNeRNN 6ewPm09F8KfgD7oTXLYiCHcykay5Le3/tjAASriHrgxrtlwPDKV63MUHzm/7rm0mvd4m ZkStOkL9q4jdBO7jJhL7X6tscebGxyD5aX017vAqwEiwYl4A64aNyfx3JJXqNmgboYFp 8hOZwMw9uFS5hJ0Hj9fcWN76fQoFTscI058j8tilXUOKQJHqgUSqWQ21twEgf9B5hEwQ 8vLQ== X-Gm-Message-State: AG10YOR9TSsZiHQhYSkumVGskWU7TvO292fWSiju/K4vtkYlKgagEHlog3dG5F+wPitjKA== X-Received: by 10.202.75.205 with SMTP id y196mr11824982oia.130.1453709638952; Mon, 25 Jan 2016 00:13:58 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id v142sm9939087oie.28.2016.01.25.00.13.58 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 25 Jan 2016 00:13:58 -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-v2 05/12] tcm_fc: Convert to target_alloc_session usage Date: Mon, 25 Jan 2016 08:10:59 +0000 Message-Id: <1453709466-6308-6-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1453709466-6308-1-git-send-email-nab@daterainc.com> References: <1453709466-6308-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; }