All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] netfs: make ops->init_rreq() optional
@ 2021-12-28 12:44 Jeffle Xu
  2022-01-06 21:49 ` Jeff Layton
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jeffle Xu @ 2021-12-28 12:44 UTC (permalink / raw)
  To: jlayton, idryomov, ceph-devel, dhowells, linux-cachefs

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 <jefflexu@linux.alibaba.com>
---
 fs/ceph/addr.c         | 5 -----
 fs/netfs/read_helper.c | 3 ++-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index e53c8541f5b2..c3537dfd8c04 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -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,
diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
index 75c76cbb27cc..0befb0747c59 100644
--- a/fs/netfs/read_helper.c
+++ b/fs/netfs/read_helper.c
@@ -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);
 	}
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] netfs: make ops->init_rreq() optional
  2021-12-28 12:44 [PATCH] netfs: make ops->init_rreq() optional Jeffle Xu
@ 2022-01-06 21:49 ` Jeff Layton
  2022-01-13  2:54   ` JeffleXu
  2022-01-13  8:10   ` David Howells
  2022-01-13  8:12 ` David Howells
  2022-01-13  8:22 ` [PATCH] netfs: Make " David Howells
  2 siblings, 2 replies; 7+ messages in thread
From: Jeff Layton @ 2022-01-06 21:49 UTC (permalink / raw)
  To: Jeffle Xu, idryomov, ceph-devel, dhowells, linux-cachefs

On Tue, 2021-12-28 at 20:44 +0800, Jeffle Xu wrote:
> 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 <jefflexu@linux.alibaba.com>
> ---
>  fs/ceph/addr.c         | 5 -----
>  fs/netfs/read_helper.c | 3 ++-
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index e53c8541f5b2..c3537dfd8c04 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -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,
> diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
> index 75c76cbb27cc..0befb0747c59 100644
> --- a/fs/netfs/read_helper.c
> +++ b/fs/netfs/read_helper.c
> @@ -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.

Reviewed-by: Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] netfs: make ops->init_rreq() optional
  2022-01-06 21:49 ` Jeff Layton
@ 2022-01-13  2:54   ` JeffleXu
  2022-01-13  8:10   ` David Howells
  1 sibling, 0 replies; 7+ messages in thread
From: JeffleXu @ 2022-01-13  2:54 UTC (permalink / raw)
  To: David Howells; +Cc: Jeff Layton, idryomov, ceph-devel, linux-cachefs

Hi David,

ping...


On 1/7/22 5:49 AM, Jeff Layton wrote:
> 
> This looks reasonable to me, since ceph doesn't need anything here
> anyway.
> 
> Reviewed-by: Jeff Layton <jlayton@kernel.org>
> 

-- 
Thanks,
Jeffle

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] netfs: make ops->init_rreq() optional
  2022-01-06 21:49 ` Jeff Layton
  2022-01-13  2:54   ` JeffleXu
@ 2022-01-13  8:10   ` David Howells
  1 sibling, 0 replies; 7+ messages in thread
From: David Howells @ 2022-01-13  8:10 UTC (permalink / raw)
  To: JeffleXu; +Cc: dhowells, Jeff Layton, idryomov, ceph-devel, linux-cachefs

Yep.  My patchset got pulled, so I'll take it now.

David


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] netfs: make ops->init_rreq() optional
  2021-12-28 12:44 [PATCH] netfs: make ops->init_rreq() optional Jeffle Xu
  2022-01-06 21:49 ` Jeff Layton
@ 2022-01-13  8:12 ` David Howells
  2022-01-13  8:22 ` [PATCH] netfs: Make " David Howells
  2 siblings, 0 replies; 7+ messages in thread
From: David Howells @ 2022-01-13  8:12 UTC (permalink / raw)
  To: Jeffle Xu; +Cc: dhowells, jlayton, idryomov, ceph-devel, linux-cachefs

Jeffle Xu <jefflexu@linux.alibaba.com> wrote:

> ---
> There's already upper fs implementing empty .init_rreq() callback, and
> thus make it optional.
> 
> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>

Btw, everything after the first "---" line will get stripped by patch
importation, so your S-o-b needs to be above that.

David


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] netfs: Make ops->init_rreq() optional
  2021-12-28 12:44 [PATCH] netfs: make ops->init_rreq() optional Jeffle Xu
  2022-01-06 21:49 ` Jeff Layton
  2022-01-13  8:12 ` David Howells
@ 2022-01-13  8:22 ` David Howells
  2022-01-13  9:11   ` JeffleXu
  2 siblings, 1 reply; 7+ messages in thread
From: David Howells @ 2022-01-13  8:22 UTC (permalink / raw)
  To: Jeffle Xu; +Cc: dhowells, jlayton, idryomov, ceph-devel, linux-cachefs

Hi Jeffle,

I've altered your patch commit message, if you could take a look?

David
---
From: Jeffle Xu <jefflexu@linux.alibaba.com>

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>
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
---
 fs/ceph/addr.c         |    5 -----
 fs/netfs/read_helper.c |    3 ++-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index b3d9459c9bbd..c98e5238a1b6 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -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,
diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
index 6169659857b3..501da990c259 100644
--- a/fs/netfs/read_helper.c
+++ b/fs/netfs/read_helper.c
@@ -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);
 	}
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] netfs: Make ops->init_rreq() optional
  2022-01-13  8:22 ` [PATCH] netfs: Make " David Howells
@ 2022-01-13  9:11   ` JeffleXu
  0 siblings, 0 replies; 7+ messages in thread
From: JeffleXu @ 2022-01-13  9:11 UTC (permalink / raw)
  To: David Howells; +Cc: jlayton, idryomov, ceph-devel, linux-cachefs



On 1/13/22 4:22 PM, David Howells wrote:
> Hi Jeffle,
> 
> I've altered your patch commit message, if you could take a look?
> 
> David
> ---
> From: Jeffle Xu <jefflexu@linux.alibaba.com>
> 
> 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>
> 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
> ---

LGTM. Thanks.


>  fs/ceph/addr.c         |    5 -----
>  fs/netfs/read_helper.c |    3 ++-
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index b3d9459c9bbd..c98e5238a1b6 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -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,
> diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
> index 6169659857b3..501da990c259 100644
> --- a/fs/netfs/read_helper.c
> +++ b/fs/netfs/read_helper.c
> @@ -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);
>  	}
>  
> 

-- 
Thanks,
Jeffle

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-13  9:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28 12:44 [PATCH] netfs: make ops->init_rreq() optional Jeffle Xu
2022-01-06 21:49 ` Jeff Layton
2022-01-13  2:54   ` JeffleXu
2022-01-13  8:10   ` David Howells
2022-01-13  8:12 ` David Howells
2022-01-13  8:22 ` [PATCH] netfs: Make " David Howells
2022-01-13  9:11   ` JeffleXu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.