linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-xfs@vger.kernel.org, darrick.wong@oracle.com
Subject: Re: [PATCH 3/3] xfs: Opencode and remove DEFINE_SINGLE_BUF_MAP
Date: Wed, 14 Aug 2019 20:23:55 +1000	[thread overview]
Message-ID: <20190814102355.GM6129@dread.disaster.area> (raw)
In-Reply-To: <20190813090306.31278-4-nborisov@suse.com>

On Tue, Aug 13, 2019 at 12:03:06PM +0300, Nikolay Borisov wrote:
> This macro encodes a trivial struct initializations, just open code it.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Hmmmm.

We have defines for this sort of structure definition and
initialisation all over the kernel. e.g. LIST_HEAD(),
DEFINE_PER_CPU(), DEFINE_HASHTABLE(), DEFINE_SPINLOCK(), etc...

And really, the intent of the define was to make it easy to get
rid of all the callers of the non-map buffer interfaces by moving
the map definition into the callers of xfs_buf_get, _read, etc
and then enabling use to remove the non-map interfaces
altogether.

Hence I'd much prefer to see the xfs_buf_{get,read,readahead} and
xfs_trans_buf_{get,read} wrapper functions go away than removing the
define.

> ---
>  fs/xfs/xfs_buf.c   | 4 ++--
>  fs/xfs/xfs_buf.h   | 9 +++------
>  fs/xfs/xfs_trans.h | 6 ++++--
>  3 files changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 99c66f80d7cc..389c5b590f11 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -658,7 +658,7 @@ xfs_buf_incore(
>  {
>  	struct xfs_buf		*bp;
>  	int			error;
> -	DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
> +	struct xfs_buf_map map = { .bm_bn = blkno, .bm_len = numblks };

FWIW, I'm not a fan of single line definitions like this because
they are really hard to read. If you are converting to this form, it
should be like this:

	struct xfs_buf_map map = {
		.bm_bn = blkno,
		.bm_len = numblks,
	};

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

      parent reply	other threads:[~2019-08-14 10:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13  9:03 [PATCH 0/3] Minor cleanups Nikolay Borisov
2019-08-13  9:03 ` [PATCH 1/3] xfs: Use __xfs_buf_submit everywhere Nikolay Borisov
2019-08-13 11:55   ` Brian Foster
2019-08-13 12:06     ` Nikolay Borisov
2019-08-13 12:15       ` Nikolay Borisov
2019-08-13  9:03 ` [PATCH 2/3] xfs: Rename __xfs_buf_submit to xfs_buf_submit Nikolay Borisov
2019-08-13 11:56   ` Brian Foster
2019-08-14 10:14     ` Dave Chinner
2019-08-13  9:03 ` [PATCH 3/3] xfs: Opencode and remove DEFINE_SINGLE_BUF_MAP Nikolay Borisov
2019-08-13 11:57   ` Brian Foster
2019-08-14 10:23   ` Dave Chinner [this message]

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=20190814102355.GM6129@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nborisov@suse.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).