linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: James Simmons <jsimmons@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org,
	Andreas Dilger <andreas.dilger@intel.com>,
	Oleg Drokin <oleg.drokin@intel.com>, Ben Evans <bevans@cray.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: Re: [PATCH 5/6] staging: lustre: headers: Move functions out of lustre_idl.h
Date: Mon, 5 Dec 2016 23:54:36 +0300	[thread overview]
Message-ID: <20161205205435.GD31243@mwanda> (raw)
In-Reply-To: <1480707650-24089-6-git-send-email-jsimmons@infradead.org>

On Fri, Dec 02, 2016 at 02:40:49PM -0500, James Simmons wrote:
> -/* If LDLM_ENQUEUE, 1 slot is already occupied, 1 is available.
> - * Otherwise, 2 are available.
> - */
> -#define ldlm_request_bufsize(count, type)				\
> -({								      \
> -	int _avail = LDLM_LOCKREQ_HANDLES;			      \
> -	_avail -= (type == LDLM_ENQUEUE ? LDLM_ENQUEUE_CANCEL_OFF : 0); \
> -	sizeof(struct ldlm_request) +				   \
> -	(count > _avail ? count - _avail : 0) *			 \
> -	sizeof(struct lustre_handle);				   \
> -})
> -

> +/**
> + * ldlm_request_bufsize
> + *
> + * @count:	number of ldlm handles
> + * @type:	ldlm opcode
> + *
> + * If opcode=LDLM_ENQUEUE, 1 slot is already occupied,
> + * LDLM_LOCKREQ_HANDLE -1 slots are available.
> + * Otherwise, LDLM_LOCKREQ_HANDLE slots are available.
> + *
> + * Return:	size of the request buffer
> + */
> +int ldlm_request_bufsize(int count, int type)
> +{
> +	int avail = LDLM_LOCKREQ_HANDLES;
> +
> +	if (type == LDLM_ENQUEUE)
> +		avail -= LDLM_ENQUEUE_CANCEL_OFF;
> +
> +	if (count > avail)
> +		avail = (count - avail) * sizeof(struct lustre_handle);
> +	else
> +		avail = 0;
> +
> +	return sizeof(struct ldlm_request) + avail;
> +}
> +

This is a nice cleanup.

regards,
dan carpenter

  reply	other threads:[~2016-12-05 20:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 19:40 [PATCH 0/6] Fix ups to make lustre_idl.h a proper UAPI header James Simmons
2016-12-02 19:40 ` [PATCH 1/6] staging: lustre: headers: move swab functions to new header files James Simmons
2016-12-02 19:40 ` [PATCH 2/6] staging: lustre: headers: sort headers affected by swab move James Simmons
2016-12-06  9:32   ` Greg Kroah-Hartman
2016-12-02 19:40 ` [PATCH 3/6] staging: lustre: obdclass: Create a header for obdo related functions James Simmons
2016-12-03 13:27   ` kbuild test robot
2016-12-05 20:50   ` Dan Carpenter
2016-12-05 21:55     ` [lustre-devel] " Dilger, Andreas
2016-12-05 22:06       ` Dan Carpenter
2016-12-07 19:18         ` James Simmons
2016-12-06  9:36   ` Greg Kroah-Hartman
2016-12-07 19:13     ` James Simmons
2016-12-02 19:40 ` [PATCH 4/6] staging: lustre: headers: sort headers affected by obdo move James Simmons
2016-12-02 19:40 ` [PATCH 5/6] staging: lustre: headers: Move functions out of lustre_idl.h James Simmons
2016-12-05 20:54   ` Dan Carpenter [this message]
2016-12-02 19:40 ` [PATCH 6/6] staging: lustre: headers: use proper byteorder functions in lustre_idl.h James Simmons

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=20161205205435.GD31243@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=andreas.dilger@intel.com \
    --cc=bevans@cray.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).