Commit a39c41b8 authored by David Howells's avatar David Howells

netfs: Pass a flag to ->prepare_write() to say if there's no alloc'd space

Pass a flag to ->prepare_write() to indicate if there's definitely no
space allocated in the cache yet (for instance if we've already checked as
we were asked to do a read).
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
cc: linux-cachefs@redhat.com
Link: https://lore.kernel.org/r/163819583123.215744.12783808230464471417.stgit@warthog.procyon.org.uk/ # v1
Link: https://lore.kernel.org/r/163906886835.143852.6689886781122679769.stgit@warthog.procyon.org.uk/ # v2
Link: https://lore.kernel.org/r/163967079100.1823006.12889542712309574359.stgit@warthog.procyon.org.uk/ # v3
Link: https://lore.kernel.org/r/164021489334.640689.3131206613015409076.stgit@warthog.procyon.org.uk/ # v4
parent 9e1aa6b8
...@@ -323,7 +323,7 @@ static void netfs_rreq_do_write_to_cache(struct netfs_read_request *rreq) ...@@ -323,7 +323,7 @@ static void netfs_rreq_do_write_to_cache(struct netfs_read_request *rreq)
} }
ret = cres->ops->prepare_write(cres, &subreq->start, &subreq->len, ret = cres->ops->prepare_write(cres, &subreq->start, &subreq->len,
rreq->i_size); rreq->i_size, true);
if (ret < 0) { if (ret < 0) {
trace_netfs_failure(rreq, subreq, ret, netfs_fail_prepare_write); trace_netfs_failure(rreq, subreq, ret, netfs_fail_prepare_write);
trace_netfs_sreq(subreq, netfs_sreq_trace_write_skip); trace_netfs_sreq(subreq, netfs_sreq_trace_write_skip);
......
...@@ -232,7 +232,8 @@ struct netfs_cache_ops { ...@@ -232,7 +232,8 @@ struct netfs_cache_ops {
* actually do. * actually do.
*/ */
int (*prepare_write)(struct netfs_cache_resources *cres, int (*prepare_write)(struct netfs_cache_resources *cres,
loff_t *_start, size_t *_len, loff_t i_size); loff_t *_start, size_t *_len, loff_t i_size,
bool no_space_allocated_yet);
}; };
struct readahead_control; struct readahead_control;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment