Skip to content

Commit cef0223

Browse files
lostjeffledhowells
authored andcommitted
netfs: Make ops->init_rreq() optional
Make the ops->init_rreq() callback optional. This isn't required for the erofs changes I'm implementing to do on-demand read through fscache[1]. Further, ceph has an empty init_rreq method that can then be removed and it's marked optional in the documentation. Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com> Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/20211227125444.21187-1-jefflexu@linux.alibaba.com/ [1] Link: https://lore.kernel.org/r/20211228124419.103020-1-jefflexu@linux.alibaba.com Link: https://lore.kernel.org/r/164251410387.3435901.2504600788262093313.stgit@warthog.procyon.org.uk/ # v1
1 parent c522e3a commit cef0223

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

fs/ceph/addr.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,6 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)
297297
dout("%s: result %d\n", __func__, err);
298298
}
299299

300-
static void ceph_init_rreq(struct netfs_read_request *rreq, struct file *file)
301-
{
302-
}
303-
304300
static void ceph_readahead_cleanup(struct address_space *mapping, void *priv)
305301
{
306302
struct inode *inode = mapping->host;
@@ -312,7 +308,6 @@ static void ceph_readahead_cleanup(struct address_space *mapping, void *priv)
312308
}
313309

314310
static const struct netfs_read_request_ops ceph_netfs_read_ops = {
315-
.init_rreq = ceph_init_rreq,
316311
.is_cache_enabled = ceph_is_cache_enabled,
317312
.begin_cache_operation = ceph_begin_cache_operation,
318313
.issue_op = ceph_netfs_issue_op,

fs/netfs/read_helper.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ static struct netfs_read_request *netfs_alloc_read_request(
5555
INIT_WORK(&rreq->work, netfs_rreq_work);
5656
refcount_set(&rreq->usage, 1);
5757
__set_bit(NETFS_RREQ_IN_PROGRESS, &rreq->flags);
58-
ops->init_rreq(rreq, file);
58+
if (ops->init_rreq)
59+
ops->init_rreq(rreq, file);
5960
netfs_stat(&netfs_n_rh_rreq);
6061
}
6162

0 commit comments

Comments
 (0)