From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965361AbcALPLX (ORCPT ); Tue, 12 Jan 2016 10:11:23 -0500 Received: from verein.lst.de ([213.95.11.211]:38479 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762700AbcALPLV (ORCPT ); Tue, 12 Jan 2016 10:11:21 -0500 Date: Tue, 12 Jan 2016 16:11:19 +0100 From: Christoph Hellwig To: "Nicholas A. Bellinger" Cc: target-devel , linux-scsi , lkml , Sagi Grimberg , Christoph Hellwig , Hannes Reinecke , Andy Grover , Vasu Dev , Vu Pham , Nicholas Bellinger Subject: Re: [PATCH-for-4.6 1/6] target: Add target_alloc_session() helper function Message-ID: <20160112151119.GD2058@lst.de> References: <1452458668-11034-1-git-send-email-nab@daterainc.com> <1452458668-11034-2-git-send-email-nab@daterainc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1452458668-11034-2-git-send-email-nab@daterainc.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +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 *)) > +{ I'd much rather have the fabrics drivers call transport_alloc_session_tags directly from the callback than growing even more arguments here. > + 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); > + } These checks should be in transport_alloc_session_tags.