[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5694283E.3070401@sandisk.com>
Date: Mon, 11 Jan 2016 14:10:06 -0800
From: Bart Van Assche <bart.vanassche@...disk.com>
To: "Nicholas A. Bellinger" <nab@...erainc.com>,
target-devel <target-devel@...r.kernel.org>
CC: linux-scsi <linux-scsi@...r.kernel.org>,
lkml <linux-kernel@...r.kernel.org>,
Sagi Grimberg <sagig@...lanox.com>,
"Christoph Hellwig" <hch@....de>, Hannes Reinecke <hare@...e.de>,
Andy Grover <agrover@...hat.com>,
Vasu Dev <vasu.dev@...ux.intel.com>, Vu Pham <vu@...lanox.com>,
Nicholas Bellinger <nab@...ux-iscsi.org>
Subject: Re: [PATCH-for-4.6 1/6] target: Add target_alloc_session() helper
function
On 01/10/2016 12:44 PM, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@...ux-iscsi.org>
>
> Based on HCH's original patch, this adds a full version to
> support percpu-ida tag pre-allocation and callback function
> pointer into fabric driver code to complete session setup.
>
> Reported-by: Christoph Hellwig <hch@....de>
> Cc: Sagi Grimberg <sagig@...lanox.com>
> Cc: Christoph Hellwig <hch@....de>
> Cc: Hannes Reinecke <hare@...e.de>
> Cc: Andy Grover <agrover@...hat.com>
> Signed-off-by: Nicholas Bellinger <nab@...ux-iscsi.org>
> ---
> drivers/target/target_core_transport.c | 55 ++++++++++++++++++++++++++++++++++
> include/target/target_core_fabric.h | 6 ++++
> 2 files changed, 61 insertions(+)
>
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index c5035b9..fd4404f6 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -374,6 +374,61 @@ void transport_register_session(
> }
> EXPORT_SYMBOL(transport_register_session);
>
> +struct se_session *
> +target_alloc_session(struct se_portal_group *tpg,
> + unsigned int tag_num, unsigned int tag_size,
> + enum target_prot_op prot_op,
> + const char *initiatorname, void *private,
> + int (*callback)(struct se_portal_group *,
> + struct se_session *, void *))
Please use a more descriptive name instead of "callback", e.g.
"init_session".
> +{
> + struct se_session *sess;
> +
> + if (tag_num != 0 && !tag_size) {
> + pr_err("target_alloc_session called with percpu-ida tag_num:"
> + " %u, but zero tag_size\n", tag_num);
> + return ERR_PTR(-EINVAL);
> + }
> + if (!tag_num && tag_size) {
> + pr_err("target_alloc_session called with percpu-ida tag_size:"
> + " %u, but zero tag_num\n", tag_size);
> + return ERR_PTR(-EINVAL);
> + }
Please combine the above two tests into a single test, e.g. !!tag_num !=
!!tag_size or (bool)tag_num != (bool)tag_size.
Thanks,
Bart.
Powered by blists - more mailing lists