Re: [RFC PATCH 12/53] netfs: Provide tools to create a buffer in an xarray

From: Matthew Wilcox
Date: Fri Oct 13 2023 - 13:28:25 EST


On Fri, Oct 13, 2023 at 05:03:41PM +0100, David Howells wrote:
> +int netfs_xa_store_and_mark(struct xarray *xa, unsigned long index,
> + struct folio *folio, bool put_mark,
> + bool pagecache_mark, gfp_t gfp_mask);

Linus has been unhappy recently with functions that take two bools.
When you're reading the caller, you see:

netfs_xa_store_and_mark(xa, index, true, false, GFP_FOO);

and you don't know instantly what true and false mean. He prefers

#define NETFS_FLAG_PUT (1 << 0)
#define NETFS_FLAG_PAGECACHE (1 << 1)

and then the caller looks like:

netfs_xa_store_and_mark(xa, index, NETFS_FLAG_PUT, GFP_FOO);

and you know exactly what it's doing.