Re: [RFC PATCH 08/53] netfs: Add rsize to netfs_io_request

From: Jeff Layton
Date: Mon Oct 16 2023 - 11:54:52 EST


On Fri, 2023-10-13 at 17:03 +0100, David Howells wrote:
> Add an rsize parameter to netfs_io_request to be filled in by the network
> filesystem when the request is initialised. This indicates the maximum
> size of a read request that the netfs will honour in that region.
>
> Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
> cc: Jeff Layton <jlayton@xxxxxxxxxx>
> cc: linux-cachefs@xxxxxxxxxx
> cc: linux-fsdevel@xxxxxxxxxxxxxxx
> cc: linux-mm@xxxxxxxxx
> ---
> fs/afs/file.c | 1 +
> fs/ceph/addr.c | 2 ++
> include/linux/netfs.h | 1 +
> 3 files changed, 4 insertions(+)
>
> diff --git a/fs/afs/file.c b/fs/afs/file.c
> index 3fea5cd8ef13..3d2e1913ea27 100644
> --- a/fs/afs/file.c
> +++ b/fs/afs/file.c
> @@ -360,6 +360,7 @@ static int afs_symlink_read_folio(struct file *file, struct folio *folio)
> static int afs_init_request(struct netfs_io_request *rreq, struct file *file)
> {
> rreq->netfs_priv = key_get(afs_file_key(file));
> + rreq->rsize = 4 * 1024 * 1024;
> return 0;
> }
>
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index ced19ff08988..92a5ddcd9a76 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -419,6 +419,8 @@ static int ceph_init_request(struct netfs_io_request *rreq, struct file *file)
> struct ceph_netfs_request_data *priv;
> int ret = 0;
>
> + rreq->rsize = 1024 * 1024;
> +

Holy magic numbers, batman! I think this deserves a comment that
explains how you came up with these values.

Also, do 9p and cifs not need this for some reason?

> if (rreq->origin != NETFS_READAHEAD)
> return 0;
>
> diff --git a/include/linux/netfs.h b/include/linux/netfs.h
> index daa431c4148d..02e888c170da 100644
> --- a/include/linux/netfs.h
> +++ b/include/linux/netfs.h
> @@ -188,6 +188,7 @@ struct netfs_io_request {
> struct list_head subrequests; /* Contributory I/O operations */
> void *netfs_priv; /* Private data for the netfs */
> unsigned int debug_id;
> + unsigned int rsize; /* Maximum read size (0 for none) */
> atomic_t nr_outstanding; /* Number of ops in progress */
> atomic_t nr_copy_ops; /* Number of copy-to-cache ops in progress */
> size_t submitted; /* Amount submitted for I/O so far */
>

--
Jeff Layton <jlayton@xxxxxxxxxx>