netfs: Use mempools for allocating requests and subrequests

Use mempools for allocating requests and subrequests in an effort to make
sure that allocation always succeeds so that when performing writeback we
can always make progress.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
This commit is contained in:
David Howells
2024-03-15 14:37:18 +00:00
parent b4ff7b178b
commit d9f85a04fb
4 changed files with 88 additions and 27 deletions

View File

@@ -20,6 +20,7 @@
#include <linux/uio.h>
enum netfs_sreq_ref_trace;
typedef struct mempool_s mempool_t;
/**
* folio_start_private_2 - Start an fscache write on a folio. [DEPRECATED]
@@ -236,8 +237,8 @@ struct netfs_io_request {
* Operations the network filesystem can/must provide to the helpers.
*/
struct netfs_request_ops {
unsigned int io_request_size; /* Alloc size for netfs_io_request struct */
unsigned int io_subrequest_size; /* Alloc size for netfs_io_subrequest struct */
mempool_t *request_pool;
mempool_t *subrequest_pool;
int (*init_request)(struct netfs_io_request *rreq, struct file *file);
void (*free_request)(struct netfs_io_request *rreq);
void (*free_subrequest)(struct netfs_io_subrequest *rreq);