All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] NFSD: Use struct knfsd_fh in struct pnfs_ff_layout
@ 2025-12-08 19:44 Chuck Lever
  2025-12-08 21:35 ` NeilBrown
  0 siblings, 1 reply; 11+ messages in thread
From: Chuck Lever @ 2025-12-08 19:44 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey
  Cc: linux-nfs, Chuck Lever, Thomas Haynes

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

In NFSD's pNFS flexfile layout implementation, struct pnfs_ff_layout
defines a struct nfs_fh field. This comes from <linux/nfs.h> :

> /*
>  * This is the kernel NFS client file handle representation
>  */
> #define NFS_MAXFHSIZE           128
> struct nfs_fh {
>         unsigned short          size;
>         unsigned char           data[NFS_MAXFHSIZE];
> };

But NFSD has an equivalent struct, knfsd_fh.

To reduce cross-subsystem header dependencies, avoid using a struct
defined by the kernel's NFS client implementation in NFSD's flexfile
layout implementation.

Cc: Thomas Haynes <loghyr@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/flexfilelayout.c    | 3 +--
 fs/nfsd/flexfilelayoutxdr.c | 4 ++--
 fs/nfsd/flexfilelayoutxdr.h | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/nfsd/flexfilelayout.c b/fs/nfsd/flexfilelayout.c
index 0f1a35400cd5..971368877006 100644
--- a/fs/nfsd/flexfilelayout.c
+++ b/fs/nfsd/flexfilelayout.c
@@ -61,8 +61,7 @@ nfsd4_ff_proc_layoutget(struct svc_rqst *rqstp, struct inode *inode,
 	if (error)
 		goto out_error;
 
-	fl->fh.size = fhp->fh_handle.fh_size;
-	memcpy(fl->fh.data, &fhp->fh_handle.fh_raw, fl->fh.size);
+	fh_copy_shallow(&fl->fh, &fhp->fh_handle);
 
 	/* Give whole file layout segments */
 	seg->offset = 0;
diff --git a/fs/nfsd/flexfilelayoutxdr.c b/fs/nfsd/flexfilelayoutxdr.c
index f9f7e38cba13..88686532f03e 100644
--- a/fs/nfsd/flexfilelayoutxdr.c
+++ b/fs/nfsd/flexfilelayoutxdr.c
@@ -30,7 +30,7 @@ nfsd4_ff_encode_layoutget(struct xdr_stream *xdr,
 	struct ff_idmap uid;
 	struct ff_idmap gid;
 
-	fh_len = 4 + fl->fh.size;
+	fh_len = 4 + fl->fh.fh_size;
 
 	uid.len = sprintf(uid.buf, "%u", from_kuid(&init_user_ns, fl->uid));
 	gid.len = sprintf(gid.buf, "%u", from_kgid(&init_user_ns, fl->gid));
@@ -63,7 +63,7 @@ nfsd4_ff_encode_layoutget(struct xdr_stream *xdr,
 				    sizeof(stateid_opaque_t));
 
 	*p++ = cpu_to_be32(1);			/* single file handle */
-	p = xdr_encode_opaque(p, fl->fh.data, fl->fh.size);
+	p = xdr_encode_opaque(p, fl->fh.fh_raw, fl->fh.fh_size);
 
 	p = xdr_encode_opaque(p, uid.buf, uid.len);
 	p = xdr_encode_opaque(p, gid.buf, gid.len);
diff --git a/fs/nfsd/flexfilelayoutxdr.h b/fs/nfsd/flexfilelayoutxdr.h
index 6d5a1066a903..5dee1722834f 100644
--- a/fs/nfsd/flexfilelayoutxdr.h
+++ b/fs/nfsd/flexfilelayoutxdr.h
@@ -39,7 +39,7 @@ struct pnfs_ff_layout {
 	kgid_t				gid;
 	struct nfsd4_deviceid		deviceid;
 	stateid_t			stateid;
-	struct nfs_fh			fh;
+	struct knfsd_fh			fh;
 };
 
 __be32 nfsd4_ff_encode_getdeviceinfo(struct xdr_stream *xdr,
-- 
2.52.0


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

end of thread, other threads:[~2025-12-10  0:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-08 19:44 [PATCH v1] NFSD: Use struct knfsd_fh in struct pnfs_ff_layout Chuck Lever
2025-12-08 21:35 ` NeilBrown
2025-12-08 21:45   ` Chuck Lever
2025-12-08 23:00     ` NeilBrown
2025-12-08 23:13       ` Chuck Lever
2025-12-09  1:04         ` Chuck Lever
2025-12-09 11:22           ` Jeff Layton
2025-12-09 21:42           ` NeilBrown
2025-12-09 22:13             ` Chuck Lever
2025-12-10  0:25               ` NeilBrown
2025-12-10  0:59             ` Chuck Lever

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.