netfs: make ops->init_rreq() optional
Subsystems (2)
PATCH 1/1 netfs: make ops->init_rreq() optional
Hi, recently I'm developing erofs over fscache for implementing on-demand read, and erofs also implements an empty .init_rreq() callback[1].
[1] https://lkml.org/lkml/2021/12/27/224
If folks don't like this cleanup and prefer empty callback in upper fs, I'm also fine with that.
---
There's already upper fs implementing empty .init_rreq() callback, and thus make it optional.
--- fs/ceph/addr.c | 5 ----- fs/netfs/read_helper.c | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-)
fs/ceph/addr.c +0 -5
@@ -291,10 +291,6 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)dout ("%s: result %d\n" , __func__, err); } -static void ceph_init_rreq (struct netfs_read_request *rreq,struct file *file) -{ -} -static void ceph_readahead_cleanup (struct address_space *mapping,void *priv) {struct inode *inode = mapping->host;
@@ -306,7 +302,6 @@ static void ceph_readahead_cleanup(struct address_space *mapping, void *priv) }static const struct netfs_read_request_ops ceph_netfs_read_ops = { - .init_rreq = ceph_init_rreq, .is_cache_enabled = ceph_is_cache_enabled, .begin_cache_operation = ceph_begin_cache_operation, .issue_op = ceph_netfs_issue_op,
fs/netfs/read_helper.c +2 -1
@@ -55,7 +55,8 @@ static struct netfs_read_request *netfs_alloc_read_request(INIT_WORK (&rreq->work, netfs_rreq_work);refcount_set (&rreq->usage,1 );__set_bit (NETFS_RREQ_IN_PROGRESS , &rreq->flags); - ops->init_rreq (rreq, file); +if (ops->init_rreq) + ops->init_rreq (rreq, file);netfs_stat (&netfs_n_rh_rreq); }
Signature · 1 line
2.27.0
Quoted 46 lines · Jeffle Xu
Hi, recently I'm developing erofs over fscache for implementing on-demand read, and erofs also implements an empty .init_rreq() callback[1].
[1] https://lkml.org/lkml/2021/12/27/224
If folks don't like this cleanup and prefer empty callback in upper fs, I'm also fine with that.
---
There's already upper fs implementing empty .init_rreq() callback, and thus make it optional.Signed-off-by Jeffle Xu <[email protected]>--- fs/ceph/addr.c | 5 ----- fs/netfs/read_helper.c | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-)fs/ceph/addr.c +0
-5@@ -291,10 +291,6 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)dout ("%s: result %d\n" , __func__, err); } -static void ceph_init_rreq (struct netfs_read_request *rreq,struct file *file) -{ -} -static void ceph_readahead_cleanup (struct address_space *mapping,void *priv) {struct inode *inode = mapping->host;@@ -306,7 +302,6 @@ static void ceph_readahead_cleanup(struct address_space *mapping, void *priv) }static const struct netfs_read_request_ops ceph_netfs_read_ops = { - .init_rreq = ceph_init_rreq, .is_cache_enabled = ceph_is_cache_enabled, .begin_cache_operation = ceph_begin_cache_operation, .issue_op = ceph_netfs_issue_op,fs/netfs/read_helper.c +0
-0
fs/netfs/read_helper.c static struct netfs_read_request *netfs_alloc_read_request( · line 62
Quoted 9 lines
fs/netfs/read_helper.c +2
-1@@ -55,7 +55,8 @@ static struct netfs_read_request *netfs_alloc_read_request(INIT_WORK (&rreq->work, netfs_rreq_work);refcount_set (&rreq->usage,1 );__set_bit (NETFS_RREQ_IN_PROGRESS , &rreq->flags); - ops->init_rreq (rreq, file); +if (ops->init_rreq) + ops->init_rreq (rreq, file);netfs_stat (&netfs_n_rh_rreq); }
This looks reasonable to me, since ceph doesn't need anything here anyway.
Hi David,
ping...
Quoted 6 lines · Jeff Layton
This looks reasonable to me, since ceph doesn't need anything here anyway.
Reviewed-by Jeff Layton <[email protected]>
Signature · 2 lines
Thanks, Jeffle
David Howells
maintainerYep. My patchset got pulled, so I'll take it now.
David
David Howells
maintainerQuoted 5 lines · Jeffle Xu
---
There's already upper fs implementing empty .init_rreq() callback, and thus make it optional.Signed-off-by Jeffle Xu <[email protected]>
Btw, everything after the first "---" line will get stripped by patch importation, so your S-o-b needs to be above that.
David
David Howells
maintainerPATCH 1/1 netfs: Make ops->init_rreq() optional
In reply to Jeffle XuHi Jeffle,
I've altered your patch commit message, if you could take a look?
David
---
From: Jeffle Xu <[email protected]>
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.
--- fs/ceph/addr.c | 5 ----- fs/netfs/read_helper.c | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-)
fs/ceph/addr.c +0 -5
@@ -297,10 +297,6 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)dout ("%s: result %d\n" , __func__, err); } -static void ceph_init_rreq (struct netfs_read_request *rreq,struct file *file) -{ -} -static void ceph_readahead_cleanup (struct address_space *mapping,void *priv) {struct inode *inode = mapping->host;
@@ -312,7 +308,6 @@ static void ceph_readahead_cleanup(struct address_space *mapping, void *priv) }static const struct netfs_read_request_ops ceph_netfs_read_ops = { - .init_rreq = ceph_init_rreq, .is_cache_enabled = ceph_is_cache_enabled, .begin_cache_operation = ceph_begin_cache_operation, .issue_op = ceph_netfs_issue_op,
fs/netfs/read_helper.c +2 -1
@@ -55,7 +55,8 @@ static struct netfs_read_request *netfs_alloc_read_request(INIT_WORK (&rreq->work, netfs_rreq_work);refcount_set (&rreq->usage,1 );__set_bit (NETFS_RREQ_IN_PROGRESS , &rreq->flags); - ops->init_rreq (rreq, file); +if (ops->init_rreq) + ops->init_rreq (rreq, file);netfs_stat (&netfs_n_rh_rreq); }
Re: [PATCH] netfs: Make ops->init_rreq() optional
Quoted 15 lines · David Howells
Hi Jeffle,
I've altered your patch commit message, if you could take a look?
David
---
From: Jeffle Xu <[email protected]>netfs: Make
ops->init_rreq()optionalMake 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 emptyinit_rreqmethod that can then be removed and it's marked optional in the documentation.
Quoted 6 lines
Signed-off-by Jeffle Xu <[email protected]>Signed-off-by David Howells <[email protected]>Reviewed-by Jeff Layton <[email protected]>---
LGTM. Thanks.
Quoted 42 lines
fs/ceph/addr.c | 5 ----- fs/netfs/read_helper.c | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-)fs/ceph/addr.c +0
-5@@ -297,10 +297,6 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)dout ("%s: result %d\n" , __func__, err); } -static void ceph_init_rreq (struct netfs_read_request *rreq,struct file *file) -{ -} -static void ceph_readahead_cleanup (struct address_space *mapping,void *priv) {struct inode *inode = mapping->host;@@ -312,7 +308,6 @@ static void ceph_readahead_cleanup(struct address_space *mapping, void *priv) }static const struct netfs_read_request_ops ceph_netfs_read_ops = { - .init_rreq = ceph_init_rreq, .is_cache_enabled = ceph_is_cache_enabled, .begin_cache_operation = ceph_begin_cache_operation, .issue_op = ceph_netfs_issue_op,fs/netfs/read_helper.c +2
-1@@ -55,7 +55,8 @@ static struct netfs_read_request *netfs_alloc_read_request(INIT_WORK (&rreq->work, netfs_rreq_work);refcount_set (&rreq->usage,1 );__set_bit (NETFS_RREQ_IN_PROGRESS , &rreq->flags); - ops->init_rreq (rreq, file); +if (ops->init_rreq) + ops->init_rreq (rreq, file);netfs_stat (&netfs_n_rh_rreq); }
Signature · 2 lines
Thanks, Jeffle