linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	ojeda@kernel.org, nathan@kernel.org, ndesaulniers@google.com,
	arnd@arndb.de
Subject: Re: [PATCH 3/5] xfs: automatic resource cleanup of for_each_perag*
Date: Mon, 9 Aug 2021 16:07:32 +0100	[thread overview]
Message-ID: <YRFEtK1CNr0Q+4nz@infradead.org> (raw)
In-Reply-To: <162814685996.2777088.11268635137040103857.stgit@magnolia>

> +# Required for for_each_perag*
> +ccflags-y += -std=gnu99

I don't think it is up to an individual subsystem to pick a specific C
dialect.

I think the most important reason why the kernel sticks with gnu89 is
to avoid the misfeature of variable declarations in the middle of
blocks, and this change would lose it.

> +	xfs_agnumber_t		last_agno = 0;
>  	int			saved_error = 0;
>  	int			error = 0;
>  	LIST_HEAD		(buffer_list);
>  
>  	/* update secondary superblocks. */
> -	for_each_perag_from(mp, agno, pag) {
> +	for_each_perag_from(mp, iter, 1) {
>  		struct xfs_buf		*bp;
>  
> +		last_agno = iter.pag->pag_agno;

This is a really horrible API as it magically injects a local variable
in a macro.  It also leads to worse code generation and a small but
noticable increase in .text sie:

hch@brick:~/work/xfs$ size xfs.o.*
   text	   data	    bss	    dec	    hex	filename
1521421	 301161	   1880	1824462	 1bd6ce	xfs.o.old
1521516	 301161	   1880	1824557	 1bd72d	xfs.o.new

  parent reply	other threads:[~2021-08-09 15:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05  7:00 [PATCHSET 0/5] xfs: other stuff for 5.15 Darrick J. Wong
2021-08-05  7:00 ` [PATCH 1/5] xfs: fix silly whitespace problems with kernel libxfs Darrick J. Wong
2021-08-06  5:45   ` Chandan Babu R
2021-08-09 14:51   ` Christoph Hellwig
2021-08-05  7:00 ` [PATCH 2/5] xfs: drop experimental warnings for bigtime and inobtcount Darrick J. Wong
2021-08-06  5:51   ` Chandan Babu R
2021-08-09 14:53   ` Christoph Hellwig
2021-08-05  7:01 ` [PATCH 3/5] xfs: automatic resource cleanup of for_each_perag* Darrick J. Wong
2021-08-06  7:15   ` Chandan Babu R
2021-08-09 15:07   ` Christoph Hellwig [this message]
2021-08-05  7:01 ` [PATCH 4/5] xfs: grab active perag ref when reading AG headers Darrick J. Wong
2021-08-06 11:25   ` Chandan Babu R
2021-08-05  7:01 ` [PATCH 5/5] xfs: dump log intent items that cannot be recovered due to corruption Darrick J. Wong
2021-08-06 11:41   ` Chandan Babu R
2021-08-09 14:55   ` Christoph Hellwig

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=YRFEtK1CNr0Q+4nz@infradead.org \
    --to=hch@infradead.org \
    --cc=arnd@arndb.de \
    --cc=djwong@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=ojeda@kernel.org \
    /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).