[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZLlId9+kXl5Tb7wj@casper.infradead.org>
Date: Thu, 20 Jul 2023 15:45:11 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Christoph Hellwig <hch@....de>
Cc: Jens Axboe <axboe@...nel.dk>,
"Darrick J. Wong" <djwong@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Christian Brauner <christian@...uner.io>,
linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-xfs@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/6] fs: add CONFIG_BUFFER_HEAD
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 ?
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index 0607790827b48a..6dc585c010c020 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -41,6 +41,12 @@ static inline struct iomap_page *to_iomap_page(struct folio *folio)
> return NULL;
> }
>
> +static inline bool iomap_use_buffer_heads(const struct iomap *iomap)
> +{
> + return IS_ENABLED(CONFIG_BUFFER_HEAD) &&
> + (iomap->flags & IOMAP_F_BUFFER_HEAD);
> +}
... because this function then goes away.
> @@ -675,7 +681,7 @@ static int iomap_write_begin(struct iomap_iter *iter, loff_t pos,
>
> if (srcmap->type == IOMAP_INLINE)
> status = iomap_write_begin_inline(iter, folio);
> - else if (srcmap->flags & IOMAP_F_BUFFER_HEAD)
> + else if (iomap_use_buffer_heads(srcmap))
... as this will be optimised away.
Powered by blists - more mailing lists