All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFSD: Remove unused function parameter
@ 2024-09-29 16:29 cel
  2024-09-29 20:12 ` Jeff Layton
  2024-09-29 22:55 ` NeilBrown
  0 siblings, 2 replies; 4+ messages in thread
From: cel @ 2024-09-29 16:29 UTC (permalink / raw)
  To: Neil Brown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey
  Cc: linux-nfs, Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

Clean up: Commit 65294c1f2c5e ("nfsd: add a new struct file caching
facility to nfsd") moved the fh_verify() call site out of
nfsd_open(). That was the only user of nfsd_open's @rqstp parameter,
so that parameter can be removed.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/filecache.c |  3 +--
 fs/nfsd/vfs.c       | 11 ++++-------
 fs/nfsd/vfs.h       |  4 ++--
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index 19bb88c7eebd..8158406bac18 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -1121,8 +1121,7 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct net *net,
 			status = nfs_ok;
 			trace_nfsd_file_opened(nf, status);
 		} else {
-			ret = nfsd_open_verified(rqstp, fhp, may_flags,
-						 &nf->nf_file);
+			ret = nfsd_open_verified(fhp, may_flags, &nf->nf_file);
 			if (ret == -EOPENSTALE && stale_retry) {
 				stale_retry = false;
 				nfsd_file_unhash(nf);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 22325b590e17..d0bf4ffa5543 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -861,8 +861,7 @@ int nfsd_open_break_lease(struct inode *inode, int access)
  * N.B. After this call fhp needs an fh_put
  */
 static int
-__nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
-			int may_flags, struct file **filp)
+__nfsd_open(struct svc_fh *fhp, umode_t type, int may_flags, struct file **filp)
 {
 	struct path	path;
 	struct inode	*inode;
@@ -937,7 +936,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
 retry:
 	err = fh_verify(rqstp, fhp, type, may_flags);
 	if (!err) {
-		host_err = __nfsd_open(rqstp, fhp, type, may_flags, filp);
+		host_err = __nfsd_open(fhp, type, may_flags, filp);
 		if (host_err == -EOPENSTALE && !retried) {
 			retried = true;
 			fh_put(fhp);
@@ -950,7 +949,6 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
 
 /**
  * nfsd_open_verified - Open a regular file for the filecache
- * @rqstp: RPC request
  * @fhp: NFS filehandle of the file to open
  * @may_flags: internal permission flags
  * @filp: OUT: open "struct file *"
@@ -958,10 +956,9 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
  * Returns zero on success, or a negative errno value.
  */
 int
-nfsd_open_verified(struct svc_rqst *rqstp, struct svc_fh *fhp, int may_flags,
-		   struct file **filp)
+nfsd_open_verified(struct svc_fh *fhp, int may_flags, struct file **filp)
 {
-	return __nfsd_open(rqstp, fhp, S_IFREG, may_flags, filp);
+	return __nfsd_open(fhp, S_IFREG, may_flags, filp);
 }
 
 /*
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index 3ff146522556..854fb95dfdca 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -114,8 +114,8 @@ __be32		nfsd_setxattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
 int 		nfsd_open_break_lease(struct inode *, int);
 __be32		nfsd_open(struct svc_rqst *, struct svc_fh *, umode_t,
 				int, struct file **);
-int		nfsd_open_verified(struct svc_rqst *rqstp, struct svc_fh *fhp,
-				   int may_flags, struct file **filp);
+int		nfsd_open_verified(struct svc_fh *fhp, int may_flags,
+				struct file **filp);
 __be32		nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
 				struct file *file, loff_t offset,
 				unsigned long *count,
-- 
2.46.2


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

* Re: [PATCH] NFSD: Remove unused function parameter
  2024-09-29 16:29 [PATCH] NFSD: Remove unused function parameter cel
@ 2024-09-29 20:12 ` Jeff Layton
  2024-09-29 22:55 ` NeilBrown
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff Layton @ 2024-09-29 20:12 UTC (permalink / raw)
  To: cel, Neil Brown, Olga Kornievskaia, Dai Ngo, Tom Talpey
  Cc: linux-nfs, Chuck Lever

On Sun, 2024-09-29 at 12:29 -0400, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> Clean up: Commit 65294c1f2c5e ("nfsd: add a new struct file caching
> facility to nfsd") moved the fh_verify() call site out of
> nfsd_open(). That was the only user of nfsd_open's @rqstp parameter,
> so that parameter can be removed.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/filecache.c |  3 +--
>  fs/nfsd/vfs.c       | 11 ++++-------
>  fs/nfsd/vfs.h       |  4 ++--
>  3 files changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> index 19bb88c7eebd..8158406bac18 100644
> --- a/fs/nfsd/filecache.c
> +++ b/fs/nfsd/filecache.c
> @@ -1121,8 +1121,7 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct net *net,
>  			status = nfs_ok;
>  			trace_nfsd_file_opened(nf, status);
>  		} else {
> -			ret = nfsd_open_verified(rqstp, fhp, may_flags,
> -						 &nf->nf_file);
> +			ret = nfsd_open_verified(fhp, may_flags, &nf->nf_file);
>  			if (ret == -EOPENSTALE && stale_retry) {
>  				stale_retry = false;
>  				nfsd_file_unhash(nf);
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 22325b590e17..d0bf4ffa5543 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -861,8 +861,7 @@ int nfsd_open_break_lease(struct inode *inode, int access)
>   * N.B. After this call fhp needs an fh_put
>   */
>  static int
> -__nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
> -			int may_flags, struct file **filp)
> +__nfsd_open(struct svc_fh *fhp, umode_t type, int may_flags, struct file **filp)
>  {
>  	struct path	path;
>  	struct inode	*inode;
> @@ -937,7 +936,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
>  retry:
>  	err = fh_verify(rqstp, fhp, type, may_flags);
>  	if (!err) {
> -		host_err = __nfsd_open(rqstp, fhp, type, may_flags, filp);
> +		host_err = __nfsd_open(fhp, type, may_flags, filp);
>  		if (host_err == -EOPENSTALE && !retried) {
>  			retried = true;
>  			fh_put(fhp);
> @@ -950,7 +949,6 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
>  
>  /**
>   * nfsd_open_verified - Open a regular file for the filecache
> - * @rqstp: RPC request
>   * @fhp: NFS filehandle of the file to open
>   * @may_flags: internal permission flags
>   * @filp: OUT: open "struct file *"
> @@ -958,10 +956,9 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
>   * Returns zero on success, or a negative errno value.
>   */
>  int
> -nfsd_open_verified(struct svc_rqst *rqstp, struct svc_fh *fhp, int may_flags,
> -		   struct file **filp)
> +nfsd_open_verified(struct svc_fh *fhp, int may_flags, struct file **filp)
>  {
> -	return __nfsd_open(rqstp, fhp, S_IFREG, may_flags, filp);
> +	return __nfsd_open(fhp, S_IFREG, may_flags, filp);
>  }
>  
>  /*
> diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
> index 3ff146522556..854fb95dfdca 100644
> --- a/fs/nfsd/vfs.h
> +++ b/fs/nfsd/vfs.h
> @@ -114,8 +114,8 @@ __be32		nfsd_setxattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
>  int 		nfsd_open_break_lease(struct inode *, int);
>  __be32		nfsd_open(struct svc_rqst *, struct svc_fh *, umode_t,
>  				int, struct file **);
> -int		nfsd_open_verified(struct svc_rqst *rqstp, struct svc_fh *fhp,
> -				   int may_flags, struct file **filp);
> +int		nfsd_open_verified(struct svc_fh *fhp, int may_flags,
> +				struct file **filp);
>  __be32		nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
>  				struct file *file, loff_t offset,
>  				unsigned long *count,

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

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

* Re: [PATCH] NFSD: Remove unused function parameter
  2024-09-29 16:29 [PATCH] NFSD: Remove unused function parameter cel
  2024-09-29 20:12 ` Jeff Layton
@ 2024-09-29 22:55 ` NeilBrown
  1 sibling, 0 replies; 4+ messages in thread
From: NeilBrown @ 2024-09-29 22:55 UTC (permalink / raw)
  To: cel
  Cc: Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey, linux-nfs,
	Chuck Lever

On Mon, 30 Sep 2024, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> Clean up: Commit 65294c1f2c5e ("nfsd: add a new struct file caching
> facility to nfsd") moved the fh_verify() call site out of
> nfsd_open(). That was the only user of nfsd_open's @rqstp parameter,
> so that parameter can be removed.

The above seemed strange to me.  Why would nfsd_open() not need
fh_verify() any more?

What actually happens was that part of nfsd_open() (including the
fh_verify() call) was factored out into __nfsd_open(), and that function
was given the same parameters as nfsd_open(), but didn't use one of
them.

Reviewed-by: NeilBrown <neilb@suse.de>

Thanks,
NeilBrown


> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/filecache.c |  3 +--
>  fs/nfsd/vfs.c       | 11 ++++-------
>  fs/nfsd/vfs.h       |  4 ++--
>  3 files changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> index 19bb88c7eebd..8158406bac18 100644
> --- a/fs/nfsd/filecache.c
> +++ b/fs/nfsd/filecache.c
> @@ -1121,8 +1121,7 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct net *net,
>  			status = nfs_ok;
>  			trace_nfsd_file_opened(nf, status);
>  		} else {
> -			ret = nfsd_open_verified(rqstp, fhp, may_flags,
> -						 &nf->nf_file);
> +			ret = nfsd_open_verified(fhp, may_flags, &nf->nf_file);
>  			if (ret == -EOPENSTALE && stale_retry) {
>  				stale_retry = false;
>  				nfsd_file_unhash(nf);
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 22325b590e17..d0bf4ffa5543 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -861,8 +861,7 @@ int nfsd_open_break_lease(struct inode *inode, int access)
>   * N.B. After this call fhp needs an fh_put
>   */
>  static int
> -__nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
> -			int may_flags, struct file **filp)
> +__nfsd_open(struct svc_fh *fhp, umode_t type, int may_flags, struct file **filp)
>  {
>  	struct path	path;
>  	struct inode	*inode;
> @@ -937,7 +936,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
>  retry:
>  	err = fh_verify(rqstp, fhp, type, may_flags);
>  	if (!err) {
> -		host_err = __nfsd_open(rqstp, fhp, type, may_flags, filp);
> +		host_err = __nfsd_open(fhp, type, may_flags, filp);
>  		if (host_err == -EOPENSTALE && !retried) {
>  			retried = true;
>  			fh_put(fhp);
> @@ -950,7 +949,6 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
>  
>  /**
>   * nfsd_open_verified - Open a regular file for the filecache
> - * @rqstp: RPC request
>   * @fhp: NFS filehandle of the file to open
>   * @may_flags: internal permission flags
>   * @filp: OUT: open "struct file *"
> @@ -958,10 +956,9 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
>   * Returns zero on success, or a negative errno value.
>   */
>  int
> -nfsd_open_verified(struct svc_rqst *rqstp, struct svc_fh *fhp, int may_flags,
> -		   struct file **filp)
> +nfsd_open_verified(struct svc_fh *fhp, int may_flags, struct file **filp)
>  {
> -	return __nfsd_open(rqstp, fhp, S_IFREG, may_flags, filp);
> +	return __nfsd_open(fhp, S_IFREG, may_flags, filp);
>  }
>  
>  /*
> diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
> index 3ff146522556..854fb95dfdca 100644
> --- a/fs/nfsd/vfs.h
> +++ b/fs/nfsd/vfs.h
> @@ -114,8 +114,8 @@ __be32		nfsd_setxattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
>  int 		nfsd_open_break_lease(struct inode *, int);
>  __be32		nfsd_open(struct svc_rqst *, struct svc_fh *, umode_t,
>  				int, struct file **);
> -int		nfsd_open_verified(struct svc_rqst *rqstp, struct svc_fh *fhp,
> -				   int may_flags, struct file **filp);
> +int		nfsd_open_verified(struct svc_fh *fhp, int may_flags,
> +				struct file **filp);
>  __be32		nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
>  				struct file *file, loff_t offset,
>  				unsigned long *count,
> -- 
> 2.46.2
> 
> 


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

* [PATCH] NFSD: Remove unused function parameter
  2024-09-30  0:50 [PATCH 0/6] Continued work on xdrgen cel
@ 2024-09-30  0:50 ` cel
  0 siblings, 0 replies; 4+ messages in thread
From: cel @ 2024-09-30  0:50 UTC (permalink / raw)
  To: Neil Brown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey
  Cc: linux-nfs, Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

Clean up: Commit 65294c1f2c5e ("nfsd: add a new struct file caching
facility to nfsd") moved the fh_verify() call site out of
nfsd_open(). That was the only user of nfsd_open's @rqstp parameter,
so that parameter can be removed.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/filecache.c |  3 +--
 fs/nfsd/vfs.c       | 11 ++++-------
 fs/nfsd/vfs.h       |  4 ++--
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index 19bb88c7eebd..8158406bac18 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -1121,8 +1121,7 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct net *net,
 			status = nfs_ok;
 			trace_nfsd_file_opened(nf, status);
 		} else {
-			ret = nfsd_open_verified(rqstp, fhp, may_flags,
-						 &nf->nf_file);
+			ret = nfsd_open_verified(fhp, may_flags, &nf->nf_file);
 			if (ret == -EOPENSTALE && stale_retry) {
 				stale_retry = false;
 				nfsd_file_unhash(nf);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 22325b590e17..d0bf4ffa5543 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -861,8 +861,7 @@ int nfsd_open_break_lease(struct inode *inode, int access)
  * N.B. After this call fhp needs an fh_put
  */
 static int
-__nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
-			int may_flags, struct file **filp)
+__nfsd_open(struct svc_fh *fhp, umode_t type, int may_flags, struct file **filp)
 {
 	struct path	path;
 	struct inode	*inode;
@@ -937,7 +936,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
 retry:
 	err = fh_verify(rqstp, fhp, type, may_flags);
 	if (!err) {
-		host_err = __nfsd_open(rqstp, fhp, type, may_flags, filp);
+		host_err = __nfsd_open(fhp, type, may_flags, filp);
 		if (host_err == -EOPENSTALE && !retried) {
 			retried = true;
 			fh_put(fhp);
@@ -950,7 +949,6 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
 
 /**
  * nfsd_open_verified - Open a regular file for the filecache
- * @rqstp: RPC request
  * @fhp: NFS filehandle of the file to open
  * @may_flags: internal permission flags
  * @filp: OUT: open "struct file *"
@@ -958,10 +956,9 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
  * Returns zero on success, or a negative errno value.
  */
 int
-nfsd_open_verified(struct svc_rqst *rqstp, struct svc_fh *fhp, int may_flags,
-		   struct file **filp)
+nfsd_open_verified(struct svc_fh *fhp, int may_flags, struct file **filp)
 {
-	return __nfsd_open(rqstp, fhp, S_IFREG, may_flags, filp);
+	return __nfsd_open(fhp, S_IFREG, may_flags, filp);
 }
 
 /*
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index 3ff146522556..854fb95dfdca 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -114,8 +114,8 @@ __be32		nfsd_setxattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
 int 		nfsd_open_break_lease(struct inode *, int);
 __be32		nfsd_open(struct svc_rqst *, struct svc_fh *, umode_t,
 				int, struct file **);
-int		nfsd_open_verified(struct svc_rqst *rqstp, struct svc_fh *fhp,
-				   int may_flags, struct file **filp);
+int		nfsd_open_verified(struct svc_fh *fhp, int may_flags,
+				struct file **filp);
 __be32		nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
 				struct file *file, loff_t offset,
 				unsigned long *count,
-- 
2.46.2


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

end of thread, other threads:[~2024-09-30  0:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-29 16:29 [PATCH] NFSD: Remove unused function parameter cel
2024-09-29 20:12 ` Jeff Layton
2024-09-29 22:55 ` NeilBrown
  -- strict thread matches above, loose matches on Subject: below --
2024-09-30  0:50 [PATCH 0/6] Continued work on xdrgen cel
2024-09-30  0:50 ` [PATCH] NFSD: Remove unused function parameter cel

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.