summaryrefslogtreecommitdiff
path: root/include/linux/netfs.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2023-11-22 17:18:17 +0000
committerDavid Howells <dhowells@redhat.com>2023-12-28 09:45:25 +0000
commite0ace6ca98bef0d8d354040f13ffc0a498813ee9 (patch)
treebf426f6aa6e3c0fa9f4b186eb79857675b7148ae /include/linux/netfs.h
parent80645bd4aa33a5c325f11b8dc6b38b38410ad5c0 (diff)
netfs, cachefiles: Pass upper bound length to allow expansion
Make netfslib pass the maximum length to the ->prepare_write() op to tell the cache how much it can expand the length of a write to. This allows a write to the server at the end of a file to be limited to a few bytes whilst writing an entire block to the cache (something required by direct I/O). 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
Diffstat (limited to 'include/linux/netfs.h')
-rw-r--r--include/linux/netfs.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/netfs.h b/include/linux/netfs.h
index 19a41c437af3..2856389f4694 100644
--- a/include/linux/netfs.h
+++ b/include/linux/netfs.h
@@ -261,6 +261,7 @@ struct netfs_io_request {
atomic_t nr_copy_ops; /* Number of copy-to-cache ops in progress */
size_t submitted; /* Amount submitted for I/O so far */
size_t len; /* Length of the request */
+ size_t upper_len; /* Length can be extended to here */
size_t transferred; /* Amount to be indicated as transferred */
short error; /* 0 or error that occurred */
enum netfs_io_origin origin; /* Origin of the request */
@@ -357,8 +358,8 @@ struct netfs_cache_ops {
* actually do.
*/
int (*prepare_write)(struct netfs_cache_resources *cres,
- loff_t *_start, size_t *_len, loff_t i_size,
- bool no_space_allocated_yet);
+ loff_t *_start, size_t *_len, size_t upper_len,
+ loff_t i_size, bool no_space_allocated_yet);
/* Prepare an on-demand read operation, shortening it to a cached/uncached
* boundary as appropriate.