linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Mike Snitzer <snitzer@kernel.org>,
	Chuck Lever <chuck.lever@oracle.com>, NeilBrown <neil@brown.name>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <Dai.Ngo@oracle.com>,  Tom Talpey <tom@talpey.com>,
	Trond Myklebust <trondmy@kernel.org>,
	Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org, linus-fsdevel@vger.kernel.org,
	 linux-mm@kvack.org
Subject: Re: [RFC PATCH v2 2/8] NFSD: Move the fh_getattr() helper
Date: Thu, 10 Jul 2025 09:59:17 -0400	[thread overview]
Message-ID: <7bea47339a061a9c76612279f565cbd298292105.camel@kernel.org> (raw)
In-Reply-To: <20250708160619.64800-3-snitzer@kernel.org>

On Tue, 2025-07-08 at 12:06 -0400, Mike Snitzer wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> Clean up: The fh_getattr() function is part of NFSD's file handle
> API, so relocate it.
> 
> I've made it an un-inlined function so that trace points and new
> functionality can easily be introduced. That increases the size of
> nfsd.ko by about a page on my x86_64 system (out of 26MB; compiled
> with -O2).
> 

Weird. I would have expected making it uninlined would decrease the
size of the binary not increase it. There are quite a few fh_getattr()
calls.

> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
> ---
>  fs/nfsd/nfsfh.c | 23 +++++++++++++++++++++++
>  fs/nfsd/nfsfh.h |  1 +
>  fs/nfsd/vfs.h   | 13 -------------
>  3 files changed, 24 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
> index 16e6b4428d55..f4a3cc9e31e0 100644
> --- a/fs/nfsd/nfsfh.c
> +++ b/fs/nfsd/nfsfh.c
> @@ -663,6 +663,29 @@ fh_update(struct svc_fh *fhp)
>  	return nfserr_serverfault;
>  }
>  
> +/**
> + * fh_getattr - Retrieve attributes on a local file
> + * @fhp: File handle of target file
> + * @stat: Caller-supplied kstat buffer to be filled in
> + *
> + * Returns nfs_ok on success, otherwise an NFS status code is
> + * returned.
> + */
> +__be32 fh_getattr(const struct svc_fh *fhp, struct kstat *stat)
> +{
> +	struct path p = {
> +		.mnt		= fhp->fh_export->ex_path.mnt,
> +		.dentry		= fhp->fh_dentry,
> +	};
> +	u32 request_mask = STATX_BASIC_STATS;
> +
> +	if (fhp->fh_maxsize == NFS4_FHSIZE)
> +		request_mask |= (STATX_BTIME | STATX_CHANGE_COOKIE);
> +
> +	return nfserrno(vfs_getattr(&p, stat, request_mask,
> +				    AT_STATX_SYNC_AS_STAT));
> +}
> +
>  /**
>   * fh_fill_pre_attrs - Fill in pre-op attributes
>   * @fhp: file handle to be updated
> diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
> index 6f5255d1c190..5ef7191f8ad8 100644
> --- a/fs/nfsd/nfsfh.h
> +++ b/fs/nfsd/nfsfh.h
> @@ -222,6 +222,7 @@ extern char * SVCFH_fmt(struct svc_fh *fhp);
>  __be32	fh_verify(struct svc_rqst *, struct svc_fh *, umode_t, int);
>  __be32	fh_verify_local(struct net *, struct svc_cred *, struct auth_domain *,
>  			struct svc_fh *, umode_t, int);
> +__be32	fh_getattr(const struct svc_fh *fhp, struct kstat *stat);
>  __be32	fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *);
>  __be32	fh_update(struct svc_fh *);
>  void	fh_put(struct svc_fh *);
> diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
> index 4007dcbbbfef..0c0292611c6d 100644
> --- a/fs/nfsd/vfs.h
> +++ b/fs/nfsd/vfs.h
> @@ -160,17 +160,4 @@ __be32		nfsd_permission(struct svc_cred *cred, struct svc_export *exp,
>  
>  void		nfsd_filp_close(struct file *fp);
>  
> -static inline __be32 fh_getattr(const struct svc_fh *fh, struct kstat *stat)
> -{
> -	u32 request_mask = STATX_BASIC_STATS;
> -	struct path p = {.mnt = fh->fh_export->ex_path.mnt,
> -			 .dentry = fh->fh_dentry};
> -
> -	if (fh->fh_maxsize == NFS4_FHSIZE)
> -		request_mask |= (STATX_BTIME | STATX_CHANGE_COOKIE);
> -
> -	return nfserrno(vfs_getattr(&p, stat, request_mask,
> -				    AT_STATX_SYNC_AS_STAT));
> -}
> -
>  #endif /* LINUX_NFSD_VFS_H */

In any case, I don't see a real benefit in keeping this as a static
inline.

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


  reply	other threads:[~2025-07-10 13:59 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08 16:06 [RFC PATCH v2 0/8] NFSD: support DIO Mike Snitzer
2025-07-08 16:06 ` [RFC PATCH v2 1/8] NFSD: Relocate the fh_want_write() and fh_drop_write() helpers Mike Snitzer
2025-07-10 13:59   ` Jeff Layton
2025-07-08 16:06 ` [RFC PATCH v2 2/8] NFSD: Move the fh_getattr() helper Mike Snitzer
2025-07-10 13:59   ` Jeff Layton [this message]
2025-07-08 16:06 ` [RFC PATCH v2 3/8] NFSD: filecache: add STATX_DIOALIGN and STATX_DIO_READ_ALIGN support Mike Snitzer
2025-07-10  7:45   ` Christoph Hellwig
2025-07-14 17:46     ` Mike Snitzer
2025-07-08 16:06 ` [RFC PATCH v2 4/8] lib/iov_iter: remove piecewise bvec length checking in iov_iter_aligned_bvec Mike Snitzer
2025-07-10  7:24   ` Christoph Hellwig
2025-07-10  7:32     ` Mike Snitzer
2025-07-10  7:44       ` Christoph Hellwig
2025-07-10 13:52   ` Jeff Layton
2025-07-10 14:48     ` Keith Busch
2025-07-10 16:12       ` Mike Snitzer
2025-07-10 16:29         ` Keith Busch
2025-07-10 17:22           ` Mike Snitzer
2025-07-10 19:51             ` Keith Busch
2025-07-10 19:57             ` Keith Busch
2025-08-01 15:23         ` Keith Busch
2025-08-01 16:10           ` Mike Snitzer
2025-07-08 16:06 ` [RFC PATCH v2 5/8] NFSD: pass nfsd_file to nfsd_iter_read() Mike Snitzer
2025-07-08 16:06 ` [RFC PATCH v2 6/8] NFSD: add io_cache_read controls to debugfs interface Mike Snitzer
2025-07-10  7:47   ` Christoph Hellwig
2025-07-14 17:33     ` Mike Snitzer
2025-07-10 14:06   ` Jeff Layton
2025-07-10 22:46     ` Chuck Lever
2025-07-14 16:47       ` Mike Snitzer
2025-07-15 11:57         ` Jeff Layton
2025-07-08 16:06 ` [RFC PATCH v2 7/8] NFSD: add io_cache_write " Mike Snitzer
2025-07-08 16:06 ` [RFC PATCH v2 8/8] NFSD: issue READs using O_DIRECT even if IO is misaligned Mike Snitzer
2025-07-08 21:22   ` Mike Snitzer
2025-07-10  7:51   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7bea47339a061a9c76612279f565cbd298292105.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=anna@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linus-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=tom@talpey.com \
    --cc=trondmy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox