linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 3/5] xfs: automatic resource cleanup of for_each_perag*
       [not found] ` <162814685996.2777088.11268635137040103857.stgit@magnolia>
@ 2021-08-09 15:07   ` Christoph Hellwig
  0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2021-08-09 15:07 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: linux-xfs, linux-kernel, ojeda, nathan, ndesaulniers, arnd

> +# 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-09 15:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <162814684332.2777088.14593133806068529811.stgit@magnolia>
     [not found] ` <162814685996.2777088.11268635137040103857.stgit@magnolia>
2021-08-09 15:07   ` [PATCH 3/5] xfs: automatic resource cleanup of for_each_perag* Christoph Hellwig

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).