netfs: Provide tools to create a buffer in an xarray

Provide tools to create a buffer in an xarray, with a function to add new
folios with a mark.  This will be used to create bounce buffer and can be
used more easily to create a list of folios the span of which would require
more than a page's worth of bio_vec structs.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
cc: linux-cachefs@redhat.com
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
This commit is contained in:
David Howells
2023-09-22 13:25:22 +01:00
parent 21d706d5cf
commit 7d828a0663
3 changed files with 98 additions and 0 deletions

View File

@@ -56,6 +56,19 @@ static inline void netfs_proc_add_rreq(struct netfs_io_request *rreq) {}
static inline void netfs_proc_del_rreq(struct netfs_io_request *rreq) {}
#endif
/*
* misc.c
*/
#define NETFS_FLAG_PUT_MARK BIT(0)
#define NETFS_FLAG_PAGECACHE_MARK BIT(1)
int netfs_xa_store_and_mark(struct xarray *xa, unsigned long index,
struct folio *folio, unsigned int flags,
gfp_t gfp_mask);
int netfs_add_folios_to_buffer(struct xarray *buffer,
struct address_space *mapping,
pgoff_t index, pgoff_t to, gfp_t gfp_mask);
void netfs_clear_buffer(struct xarray *buffer);
/*
* objects.c
*/