Re: [PATCH 6/6] fs: add CONFIG_BUFFER_HEAD

From: Christoph Hellwig
Date: Fri Jul 21 2023 - 02:24:31 EST


On Thu, Jul 20, 2023 at 03:45:11PM +0100, Matthew Wilcox wrote:
> On Thu, Jul 20, 2023 at 04:04:52PM +0200, Christoph Hellwig wrote:
> > @@ -400,7 +391,8 @@ static int blkdev_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
> > iomap->type = IOMAP_MAPPED;
> > iomap->addr = iomap->offset;
> > iomap->length = isize - iomap->offset;
> > - iomap->flags |= IOMAP_F_BUFFER_HEAD;
> > + if (IS_ENABLED(CONFIG_BUFFER_HEAD))
> > + iomap->flags |= IOMAP_F_BUFFER_HEAD;
>
> Wouldn't it be simpler to do ...
>
> +#ifdef CONFIG_BUFFER_HEAD
> #define IOMAP_F_BUFFER_HEAD (1U << 4)
> +#else
> +#define IOMAP_F_BUFFER_HEAD 0
> +#endif
>
> in include/linux/iomap.h ?

> ... because this function then goes away.

I guess we could do that. It is less intrusive, but I have to say I find
flags that get defined away to 0 fairly confusing for the reader.