Re: [PATCH v2 02/18] xfs: convert iomap ops to ->iomap_next()

From: Darrick J. Wong

Date: Fri Jul 03 2026 - 11:55:47 EST


On Fri, Jul 03, 2026 at 02:33:40PM +0200, Christoph Hellwig wrote:
> On Thu, Jul 02, 2026 at 09:48:06AM -0700, Darrick J. Wong wrote:
> > You /could/ use a bunch of fugly macros to simulate a default NULL
> > iomap_end_fn parameter.
> >
> > #define __default_iomap_end(a,b,...) b
> > #define default_iomap_end(...) __default_iomap_end(,##__VA_ARGS,NULL)
> >
> > #define iomap_process(iter, iomap, srcmap, iomap_begin, ...) \
> > __iomap_process((iter), (iomap), (srcmap), (iomap_begin),
> > default_iomap_end(__VA_ARGS__))
>
> Don't go there. These variable number or argument macros are a
> complete pain to undestand and generate horrible compiler warnings
> whenever someone messes up their first attempt at writing some
> code (guess who never gets the first pass right? :))

I /did/ label that as 'fugly'; I barely understand the subtlety that
goes on in __define_iomap_end. :)

--D