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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux