All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
	devel@driverdev.osuosl.org,
	Andreas Dilger <andreas.dilger@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	HPDD-discuss@ml01.01.org
Subject: Re: [PATCH] staging: lustre: obd_support: Add obd_cpt_alloc function
Date: Sat, 02 May 2015 21:47:07 +0000	[thread overview]
Message-ID: <20150502214707.GI14154@mwanda> (raw)
In-Reply-To: <1430601408-12847-1-git-send-email-Julia.Lawall@lip6.fr>

On Sat, May 02, 2015 at 11:16:48PM +0200, Julia Lawall wrote:

> Some questions: Is the name OK?  Is the NULL test needed?  If not, should
> the call to kzalloc_node with the call to cfs_cpt_spread_node just be
> inlined into the call sites?
> 
>  drivers/staging/lustre/lustre/include/obd_support.h |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
> index 2991d2e..3d380f0 100644
> --- a/drivers/staging/lustre/lustre/include/obd_support.h
> +++ b/drivers/staging/lustre/lustre/include/obd_support.h
> @@ -655,6 +655,15 @@ do {									      \
>  #define OBD_CPT_ALLOC_PTR(ptr, cptab, cpt)				      \
>  	OBD_CPT_ALLOC(ptr, cptab, cpt, sizeof(*(ptr)))
>  
> +static inline void *obd_cpt_alloc(struct cfs_cpt_table *cptab, int cpt,
> +				  size_t size, gfp_t flags)
> +{
> +	return (cptab) = NULL ?

These parens aren't needed any more.

I feel like people shouldn't deliberately call this with dptab = NULL.
I looked at it a bit and wasn't sure, (was sleepy though), so it's maybe
safest to keep the test.

I wish that cfs_cpt_spread_node() accepted NULL pointers so that we
didn't have to have the check for "cptab = NULL".  But your patch seems
like the way forward for now.

> +		kzalloc(size, flags) :
> +		kzalloc_node(size, flags, cfs_cpt_spread_node(cptab, cpt));
> +}
> +

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
	devel@driverdev.osuosl.org,
	Andreas Dilger <andreas.dilger@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	HPDD-discuss@ml01.01.org
Subject: Re: [PATCH] staging: lustre: obd_support: Add obd_cpt_alloc function
Date: Sun, 3 May 2015 00:47:07 +0300	[thread overview]
Message-ID: <20150502214707.GI14154@mwanda> (raw)
In-Reply-To: <1430601408-12847-1-git-send-email-Julia.Lawall@lip6.fr>

On Sat, May 02, 2015 at 11:16:48PM +0200, Julia Lawall wrote:

> Some questions: Is the name OK?  Is the NULL test needed?  If not, should
> the call to kzalloc_node with the call to cfs_cpt_spread_node just be
> inlined into the call sites?
> 
>  drivers/staging/lustre/lustre/include/obd_support.h |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
> index 2991d2e..3d380f0 100644
> --- a/drivers/staging/lustre/lustre/include/obd_support.h
> +++ b/drivers/staging/lustre/lustre/include/obd_support.h
> @@ -655,6 +655,15 @@ do {									      \
>  #define OBD_CPT_ALLOC_PTR(ptr, cptab, cpt)				      \
>  	OBD_CPT_ALLOC(ptr, cptab, cpt, sizeof(*(ptr)))
>  
> +static inline void *obd_cpt_alloc(struct cfs_cpt_table *cptab, int cpt,
> +				  size_t size, gfp_t flags)
> +{
> +	return (cptab) == NULL ?

These parens aren't needed any more.

I feel like people shouldn't deliberately call this with dptab == NULL.
I looked at it a bit and wasn't sure, (was sleepy though), so it's maybe
safest to keep the test.

I wish that cfs_cpt_spread_node() accepted NULL pointers so that we
didn't have to have the check for "cptab == NULL".  But your patch seems
like the way forward for now.

> +		kzalloc(size, flags) :
> +		kzalloc_node(size, flags, cfs_cpt_spread_node(cptab, cpt));
> +}
> +

regards,
dan carpenter

  parent reply	other threads:[~2015-05-02 21:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-02 21:16 [PATCH] staging: lustre: obd_support: Add obd_cpt_alloc function Julia Lawall
2015-05-02 21:16 ` Julia Lawall
2015-05-02 21:38 ` Drokin, Oleg
2015-05-02 21:38   ` Drokin, Oleg
2015-05-03  5:53   ` Julia Lawall
2015-05-03  5:53     ` Julia Lawall
2015-05-03 10:29     ` Drokin, Oleg
2015-05-03 10:29       ` Drokin, Oleg
2015-05-02 21:47 ` Dan Carpenter [this message]
2015-05-02 21:47   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150502214707.GI14154@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=HPDD-discuss@ml01.01.org \
    --cc=Julia.Lawall@lip6.fr \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.