Skip to contentSkip to conversation

NFSv4-related tidying

PATCH In review Chuck Lever 2 participants 8 messages Jul 17 – Jul 20

Subsystems (3)
lore
Share & tools
lore

Chuck Lever

author maintainer
#0 lore raw

cover NFSv4-related tidying

Now that Neil's vfs_create() rework has been applied to nfsd-testing, I feel more comfortable sending along more of these clean-up patches. The goal is to reduce dependencies on single large individual headers that pull in items that are irrelevant in many cases.

Chuck Lever (6):
NFSD: Move XDR encoding helpers out of xdr4.h
NFSD: Move pre-xdr'ed status codes out of nfsd.h
NFSD: Remove two unused NFSv4 constants
NFSD: Relocate NFSv4-internal constants to state.h
NFSD: Evacuate NFSv4 entry-point prototypes from nfsd.h
NFSD: Move nfsd_v4client() out of nfsd.h

 fs/nfsd/blocklayout.c        |   1 +
 fs/nfsd/blocklayoutxdr.c     |  11 ++
 fs/nfsd/export.c             |   2 +
 fs/nfsd/filecache.c          |   1 +
 fs/nfsd/flexfilelayout.c     |   1 +
 fs/nfsd/flexfilelayoutxdr.c  |   1 +
 fs/nfsd/lockd.c              |   1 +
 fs/nfsd/nfs2acl.c            |   1 +
 fs/nfsd/nfs3acl.c            |   1 +
 fs/nfsd/nfs3proc.c           |   1 +
 fs/nfsd/nfs3xdr.c            |   1 +
 fs/nfsd/nfs4acl.c            |   1 +
 fs/nfsd/nfs4callback.c       |   1 +
 fs/nfsd/nfs4ctl.h            |  83 ++++++++++++
 fs/nfsd/nfs4idmap.c          |   1 +
 fs/nfsd/nfs4layouts.c        |   1 +
 fs/nfsd/nfs4proc.c           |   2 +
 fs/nfsd/nfs4recover.c        |   1 +
 fs/nfsd/nfs4state.c          |   2 +
 fs/nfsd/nfs4xdr.c            |  93 +++++++++++++
 fs/nfsd/nfscache.c           |   1 +
 fs/nfsd/nfsctl.c             |   2 +
 fs/nfsd/nfsd.h               | 236 +--------------------------------
 fs/nfsd/{nfsd.h => nfserr.h} | 248 +----------------------------------
 fs/nfsd/nfsfh.c              |   1 +
 fs/nfsd/nfsproc.c            |   1 +
 fs/nfsd/nfssvc.c             |   8 ++
 fs/nfsd/nfsxdr.c             |   1 +
 fs/nfsd/state.h              |  19 +++
 fs/nfsd/vfs.c                |   2 +
 fs/nfsd/xdr4.h               | 139 --------------------
 31 files changed, 250 insertions(+), 615 deletions(-)
 create mode 100644 fs/nfsd/nfs4ctl.h
 copy fs/nfsd/{nfsd.h => nfserr.h} (50%)
Signature · 1 line
2.54.0
author maintainer
#1 lore raw

PATCH 1/6 NFSD: Move XDR encoding helpers out of xdr4.h

These static inline helpers use the nfserr_resource macro, which pulls in the whole rack of NFS status codes. Move those helpers into the only file that uses them, to get rid of the nfserr macro dependency globally.

These helper were originally placed in xdr4.h because I thought they would be utilized in the rest of the NFSv4 XDR code, but XDR translation is eventually to be subsumed by xdrgen instead. I'm not converting them now because that is much more churn than this patch is.

---
 fs/nfsd/blocklayoutxdr.c |  10 +++
 fs/nfsd/nfs4xdr.c        |  92 ++++++++++++++++++++++++++
 fs/nfsd/xdr4.h           | 139 ---------------------------------------
 3 files changed, 102 insertions(+), 139 deletions(-)
fs/nfsd/blocklayoutxdr.c +10 -0
index f80dbc41fd5f..51cc2a07d7b3 100644
@@ -13,6 +13,16 @@
 
 #define NFSDDBG_FACILITY	NFSDDBG_PNFS
 
+static __be32
+nfsd4_decode_deviceid4(struct xdr_stream *xdr, struct nfsd4_deviceid *devid)
+{
+	__be32 *p = xdr_inline_decode(xdr, NFS4_DEVICEID4_SIZE);
+
+	if (unlikely(!p))
+		return nfserr_bad_xdr;
+	svcxdr_decode_deviceid4(p, devid);
+	return nfs_ok;
+}
 
 /**
  * nfsd4_block_encode_layoutget - encode block/scsi layout extent array
fs/nfsd/nfs4xdr.c +92 -0

104 lines not on this page · raw message

fs/nfsd/xdr4.h +0 -139

151 lines not on this page · raw message

Signature · 1 line
2.54.0
author maintainer
#2 lore raw

PATCH 2/6 NFSD: Move pre-xdr'ed status codes out of nfsd.h

In reply to Chuck Lever

nfsd.h is included by nearly every NFSD translation unit, so its include of <linux/nfs4.h> reaches all of them, whether or not they touch NFSv4. That include existed solely for the block of pre-xdr'ed nfserr_* values at the end of the file: several of those values, such as nfserr_delay and nfserr_admin_revoked, are built from NFS4ERR_* constants defined in nfs4.h. The NFSD-internal error enum that follows the block (NFSERR_EOF and friends) is anchored at an impossible nfsstat4 value, thus it also needs nothing from nfs4.h. But these codes are used by all NFS versions, so their new home must be version-neutral.

Move the pre-xdr'ed value block and the internal error enum into a new fs/nfsd/nfserr.h, which includes nfs4.h itself, and drop the nfs4.h include from nfsd.h. Include nfserr.h directly from each translation unit that references the pre-xdr'ed values or the internal error codes, rather than carrying it in a widely-included header.

A translation unit that includes nfsd.h without using the error block no longer pulls in nfs4.h. The ones that reference the block can still reach it through nfserr.h.

---
 fs/nfsd/blocklayout.c        |   1 +
 fs/nfsd/blocklayoutxdr.c     |   1 +
 fs/nfsd/export.c             |   1 +
 fs/nfsd/filecache.c          |   1 +
 fs/nfsd/flexfilelayout.c     |   1 +
 fs/nfsd/flexfilelayoutxdr.c  |   1 +
 fs/nfsd/lockd.c              |   1 +
 fs/nfsd/nfs2acl.c            |   1 +
 fs/nfsd/nfs3acl.c            |   1 +
 fs/nfsd/nfs3proc.c           |   1 +
 fs/nfsd/nfs3xdr.c            |   1 +
 fs/nfsd/nfs4acl.c            |   1 +
 fs/nfsd/nfs4callback.c       |   1 +
 fs/nfsd/nfs4idmap.c          |   1 +
 fs/nfsd/nfs4layouts.c        |   1 +
 fs/nfsd/nfs4proc.c           |   1 +
 fs/nfsd/nfs4state.c          |   1 +
 fs/nfsd/nfs4xdr.c            |   1 +
 fs/nfsd/nfscache.c           |   1 +
 fs/nfsd/nfsctl.c             |   1 +
 fs/nfsd/nfsd.h               | 143 --------------------
 fs/nfsd/{nfsd.h => nfserr.h} | 248 +----------------------------------
 fs/nfsd/nfsfh.c              |   1 +
 fs/nfsd/nfsproc.c            |   1 +
 fs/nfsd/nfssvc.c             |   2 +
 fs/nfsd/nfsxdr.c             |   1 +
 fs/nfsd/vfs.c                |   1 +
 27 files changed, 33 insertions(+), 384 deletions(-)
 copy fs/nfsd/{nfsd.h => nfserr.h} (50%)
fs/nfsd/blocklayout.c +1 -0
index 5be7721c22c2..df02cf746479 100644
@@ -9,6 +9,7 @@
 
 #include <linux/nfsd/debug.h>
 
+#include "nfserr.h"
 #include "blocklayoutxdr.h"
 #include "pnfs.h"
 #include "filecache.h"
fs/nfsd/blocklayoutxdr.c +1 -0
index 51cc2a07d7b3..a6589f5c878a 100644
@@ -8,6 +8,7 @@
 #include <linux/nfs4.h>
 
 #include "nfsd.h"
+#include "nfserr.h"
 #include "blocklayoutxdr.h"
 #include "vfs.h"
 
fs/nfsd/export.c +1 -0
index 5aefb388cc27..f18de5f66ce6 100644
@@ -21,6 +21,7 @@
 #include <uapi/linux/nfsd_netlink.h>
 
 #include "nfsd.h"
+#include "nfserr.h"
 #include "nfsfh.h"
 #include "netns.h"
 #include "pnfs.h"
fs/nfsd/filecache.c +1 -0
index b9548eb17c77..3539149cc75f 100644
@@ -43,6 +43,7 @@
 
 #include "vfs.h"
 #include "nfsd.h"
+#include "nfserr.h"
 #include "nfsfh.h"
 #include "netns.h"
 #include "filecache.h"
fs/nfsd/flexfilelayout.c +1 -0
index 6d531285ab43..9f532418cac8 100644
@@ -13,6 +13,7 @@
 
 #include <linux/sunrpc/addr.h>
 
+#include "nfserr.h"
 #include "flexfilelayoutxdr.h"
 #include "pnfs.h"
 #include "vfs.h"
fs/nfsd/flexfilelayoutxdr.c +1 -0
index 374e52d3064a..97d8a28dd3a0 100644
@@ -6,6 +6,7 @@
 #include <linux/nfs4.h>
 
 #include "nfsd.h"
+#include "nfserr.h"
 #include "flexfilelayoutxdr.h"
 
 #define NFSDDBG_FACILITY	NFSDDBG_PNFS
fs/nfsd/lockd.c +1 -0
index 72a5b499839d..f5a4f352f8ab 100644
@@ -10,6 +10,7 @@
 #include <linux/file.h>
 #include <linux/lockd/bind.h>
 #include "nfsd.h"
+#include "nfserr.h"
 #include "vfs.h"
 
 #define NFSDDBG_FACILITY		NFSDDBG_LOCKD
fs/nfsd/nfs2acl.c +1 -0
index 190f5a001900..aba69dd278a1 100644
@@ -6,6 +6,7 @@
  */
 
 #include "nfsd.h"
+#include "nfserr.h"
 /* FIXME: nfsacl.h is a broken header */
 #include <linux/nfsacl.h>
 #include <linux/gfp.h>
fs/nfsd/nfs3acl.c +1 -0
index 6b6b289db636..7183995182ab 100644
@@ -6,6 +6,7 @@
  */
 
 #include "nfsd.h"
+#include "nfserr.h"
 /* FIXME: nfsacl.h is a broken header */
 #include <linux/nfsacl.h>
 #include <linux/gfp.h>
fs/nfsd/nfs3proc.c +1 -0
index 1df3c719e0da..4b3075c05b97 100644
@@ -13,6 +13,7 @@
 #include "cache.h"
 #include "xdr3.h"
 #include "vfs.h"
+#include "nfserr.h"
 #include "filecache.h"
 #include "trace.h"
 
fs/nfsd/nfs3xdr.c +1 -0
index e481804bb120..196bcc6edebb 100644
@@ -13,6 +13,7 @@
 #include "auth.h"
 #include "netns.h"
 #include "vfs.h"
+#include "nfserr.h"
 
 /*
  * Force construction of an empty post-op attr
fs/nfsd/nfs4acl.c +1 -0
index 2c2f2fd89e87..94f6ad381ebe 100644
@@ -40,6 +40,7 @@
 
 #include "nfsfh.h"
 #include "nfsd.h"
+#include "nfserr.h"
 #include "acl.h"
 #include "vfs.h"
 
fs/nfsd/nfs4callback.c +1 -0
index a901bbe67e03..509195d488c9 100644
@@ -37,6 +37,7 @@
 #include <linux/sunrpc/svc_xprt.h>
 #include <linux/slab.h>
 #include "nfsd.h"
+#include "nfserr.h"
 #include "state.h"
 #include "netns.h"
 #include "stats.h"
fs/nfsd/nfs4idmap.c +1 -0
index e9faf8b78f74..4e5297593963 100644
@@ -41,6 +41,7 @@
 #include "auth.h"
 #include "idmap.h"
 #include "nfsd.h"
+#include "nfserr.h"
 #include "netns.h"
 #include "vfs.h"
 
fs/nfsd/nfs4layouts.c +1 -0
index 22bcb6d09f70..4187202f9acc 100644
@@ -9,6 +9,7 @@
 #include <linux/sched.h>
 #include <linux/sunrpc/addr.h>
 
+#include "nfserr.h"
 #include "pnfs.h"
 #include "netns.h"
 #include "trace.h"
fs/nfsd/nfs4proc.c +1 -0
index d4e9010308a4..2aef7f7202b3 100644
@@ -51,6 +51,7 @@
 #include "netns.h"
 #include "acl.h"
 #include "pnfs.h"
+#include "nfserr.h"
 #include "trace.h"
 
 static bool inter_copy_offload_enable;
fs/nfsd/nfs4state.c +1 -0
index 18e17232cf94..a3bfcefa7bc9 100644
@@ -52,6 +52,7 @@
 #include "vfs.h"
 #include "current_stateid.h"
 #include "stats.h"
+#include "nfserr.h"
 
 #include "netns.h"
 #include "pnfs.h"
fs/nfsd/nfs4xdr.c +1 -0
index 05d64733094b..7ccc7c897b00 100644
@@ -54,6 +54,7 @@
 #include "xdr4.h"
 #include "vfs.h"
 #include "state.h"
+#include "nfserr.h"
 #include "cache.h"
 #include "netns.h"
 #include "pnfs.h"
fs/nfsd/nfscache.c +1 -0
index c7db532c8523..80364b91331a 100644
@@ -19,6 +19,7 @@
 #include <net/checksum.h>
 
 #include "nfsd.h"
+#include "nfserr.h"
 #include "netns.h"
 #include "stats.h"
 #include "cache.h"
fs/nfsd/nfsctl.c +1 -0
index adb032b7311a..8521b648a970 100644
@@ -23,6 +23,7 @@
 
 #include "idmap.h"
 #include "nfsd.h"
+#include "nfserr.h"
 #include "netns.h"
 #include "stats.h"
 #include "cache.h"
fs/nfsd/nfsd.h +0 -143

155 lines not on this page · raw message

fs/nfsd/nfserr.h renamed from fs/nfsd/nfsd.h +7 -241

262 lines not on this page · raw message

fs/nfsd/nfsfh.c +1 -0
index c0a46784d525..fd721a5a6b37 100644
@@ -13,6 +13,7 @@
 #include <linux/sunrpc/svcauth_gss.h>
 #include <crypto/utils.h>
 #include "nfsd.h"
+#include "nfserr.h"
 #include "netns.h"
 #include "stats.h"
 #include "vfs.h"
fs/nfsd/nfsproc.c +1 -0
index 2a82fa64e478..919acfba356a 100644
@@ -10,6 +10,7 @@
 #include "cache.h"
 #include "xdr.h"
 #include "vfs.h"
+#include "nfserr.h"
 #include "trace.h"
 
 #define NFSDDBG_FACILITY		NFSDDBG_PROC
fs/nfsd/nfssvc.c +2 -0
index 2edf716ea022..7f6ffbe7be28 100644
@@ -25,7 +25,9 @@
 #include <net/addrconf.h>
 #include <net/ipv6.h>
 #include <net/net_namespace.h>
+
 #include "nfsd.h"
+#include "nfserr.h"
 #include "cache.h"
 #include "vfs.h"
 #include "netns.h"
fs/nfsd/nfsxdr.c +1 -0
index 019f0cc971a7..0961c13d6ab1 100644
@@ -8,6 +8,7 @@
 #include <linux/filelock.h>
 
 #include "vfs.h"
+#include "nfserr.h"
 #include "xdr.h"
 #include "auth.h"
 
fs/nfsd/vfs.c +1 -0
index ef1881f520f6..25417bd94e71 100644
@@ -43,6 +43,7 @@
 #endif /* CONFIG_NFSD_V4 */
 
 #include "nfsd.h"
+#include "nfserr.h"
 #include "netns.h"
 #include "stats.h"
 #include "vfs.h"
Signature · 1 line
2.54.0
author maintainer
#3 lore raw

PATCH 3/6 NFSD: Remove two unused NFSv4 constants

In reply to Chuck Lever

Neither COMPOUND_SLACK_SPACE nor NFSD_COURTESY_CLIENT_TIMEOUT has a remaining user. COMPOUND_SLACK_SPACE lost its last reference in commit ea8d7720b274 ("nfsd4: remove redundant encode buffer size checking"), which deleted the encode buffer-space check the macro fed; the comment above it still describes that departed check. NFSD_COURTESY_CLIENT_TIMEOUT is likewise unreferenced: the courteous-server code expires clients through the laundromat's reaper and conflict paths, never a fixed 24-hour timer.

---
 fs/nfsd/nfsd.h | 7 -------
 1 file changed, 7 deletions(-)
fs/nfsd/nfsd.h +0 -7
index 384a2498b6a2..27e5384cd849 100644
@@ -204,21 +204,14 @@ void		nfsd_lockd_shutdown(void);
  * we might process an operation with side effects, and be unable to
  * tell the client that the operation succeeded.
  *
- * COMPOUND_SLACK_SPACE - this is the minimum bytes of buffer space
- * needed to encode an "ordinary" _successful_ operation.  (GETATTR,
- * READ, READDIR, and READLINK have their own buffer checks.)  if we
- * fall below this level, we fail the next operation with NFS4ERR_RESOURCE.
- *
  * COMPOUND_ERR_SLACK_SPACE - this is the minimum bytes of buffer space
  * needed to encode an operation which has failed with NFS4ERR_RESOURCE.
  * care is taken to ensure that we never fall below this level for any
  * reason.
  */
-#define	COMPOUND_SLACK_SPACE		140    /* OP_GETFH */
 #define COMPOUND_ERR_SLACK_SPACE	16     /* OP_SETATTR */
 
 #define NFSD_LAUNDROMAT_MINTIMEOUT      1   /* seconds */
-#define	NFSD_COURTESY_CLIENT_TIMEOUT	(24 * 60 * 60)	/* seconds */
 #define	NFSD_CLIENT_MAX_TRIM_PER_RUN	128
 #define	NFS4_CLIENTS_PER_GB		1024
 #define NFSD_DELEGRETURN_TIMEOUT	(HZ / 34)	/* 30ms */
Signature · 1 line
2.54.0
author maintainer
#4 lore raw

PATCH 4/6 NFSD: Relocate NFSv4-internal constants to state.h

In reply to Chuck Lever

The COMPOUND encode-slack sizes and the state-management timeouts at the tail of nfsd.h are evaluated only by NFSv4 code (nfs4state.c, nfs4proc.c, and nfs4xdr.c). They nonetheless sit in nfsd.h, where every NFSD translation unit, including the NFSv2 and NFSv3 paths that have no use for them, has to parse them.

All three consumers already reach state.h through xdr4.h, so move the block there. nfsd.h keeps the NFSv4 prototypes for now. Only the pure constants move.

---
 fs/nfsd/nfsd.h  | 18 ------------------
 fs/nfsd/state.h | 19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 18 deletions(-)
fs/nfsd/nfsd.h +0 -18
index 27e5384cd849..1886f6d42929 100644
@@ -199,24 +199,6 @@ void		nfsd_lockd_shutdown(void);
 
 #ifdef CONFIG_NFSD_V4
 
-/* before processing a COMPOUND operation, we have to check that there
- * is enough space in the buffer for XDR encode to succeed.  otherwise,
- * we might process an operation with side effects, and be unable to
- * tell the client that the operation succeeded.
- *
- * COMPOUND_ERR_SLACK_SPACE - this is the minimum bytes of buffer space
- * needed to encode an operation which has failed with NFS4ERR_RESOURCE.
- * care is taken to ensure that we never fall below this level for any
- * reason.
- */
-#define COMPOUND_ERR_SLACK_SPACE	16     /* OP_SETATTR */
-
-#define NFSD_LAUNDROMAT_MINTIMEOUT      1   /* seconds */
-#define	NFSD_CLIENT_MAX_TRIM_PER_RUN	128
-#define	NFS4_CLIENTS_PER_GB		1024
-#define NFSD_DELEGRETURN_TIMEOUT	(HZ / 34)	/* 30ms */
-#define	NFSD_CB_GETATTR_TIMEOUT		NFSD_DELEGRETURN_TIMEOUT
-
 extern int nfsd4_is_junction(struct dentry *dentry);
 extern int register_cld_notifier(void);
 extern void unregister_cld_notifier(void);
fs/nfsd/state.h +19 -0
index 2d00a411c663..c4627dc91e20 100644
@@ -45,6 +45,25 @@
 #include "nfsfh.h"
 #include "nfsd.h"
 
+/*
+ * Before processing a COMPOUND operation, we have to check that there
+ * is enough space in the buffer for XDR encode to succeed.  otherwise,
+ * we might process an operation with side effects, and be unable to
+ * tell the client that the operation succeeded.
+ *
+ * COMPOUND_ERR_SLACK_SPACE - this is the minimum bytes of buffer space
+ * needed to encode an operation which has failed with NFS4ERR_RESOURCE.
+ * care is taken to ensure that we never fall below this level for any
+ * reason.
+ */
+#define COMPOUND_ERR_SLACK_SPACE	16     /* OP_SETATTR */
+
+#define NFSD_LAUNDROMAT_MINTIMEOUT      1   /* seconds */
+#define	NFSD_CLIENT_MAX_TRIM_PER_RUN	128
+#define	NFS4_CLIENTS_PER_GB		1024
+#define NFSD_DELEGRETURN_TIMEOUT	(HZ / 34)	/* 30ms */
+#define	NFSD_CB_GETATTR_TIMEOUT		NFSD_DELEGRETURN_TIMEOUT
+
 typedef struct {
 	u32             cl_boot;
 	u32             cl_id;
Signature · 1 line
2.54.0
author maintainer
#5 lore raw

PATCH 5/6 NFSD: Evacuate NFSv4 entry-point prototypes from nfsd.h

In reply to Chuck Lever

nfsd.h is included by nearly every NFSD translation unit, yet the two blocks of NFSv4 lifecycle and control prototypes it carries are referenced by only seven of them (out of over two dozen). The remaining consumers, including the NFSv2 and NFSv3 ACL and XDR paths, parse these declarations for no benefit.

The declarations cannot simply move into an NFSv4-only header such as state.h: nfssvc.c, nfsctl.c, vfs.c, and export.c call the routines unconditionally and rely on the CONFIG_NFSD_V4=n stubs, and pulling the heavy state.h types into those lean translation units to obtain a handful of prototypes would trade one form of coupling for a worse one.

---
 fs/nfsd/export.c      |  1 +
 fs/nfsd/nfs4ctl.h     | 83 +++++++++++++++++++++++++++++++++++++++++++
 fs/nfsd/nfs4proc.c    |  1 +
 fs/nfsd/nfs4recover.c |  1 +
 fs/nfsd/nfs4state.c   |  1 +
 fs/nfsd/nfsctl.c      |  1 +
 fs/nfsd/nfsd.h        | 63 --------------------------------
 fs/nfsd/nfssvc.c      |  1 +
 fs/nfsd/vfs.c         |  1 +
 9 files changed, 90 insertions(+), 63 deletions(-)
 create mode 100644 fs/nfsd/nfs4ctl.h
fs/nfsd/export.c +1 -0
index f18de5f66ce6..961d660e2c62 100644
@@ -22,6 +22,7 @@
 
 #include "nfsd.h"
 #include "nfserr.h"
+#include "nfs4ctl.h"
 #include "nfsfh.h"
 #include "netns.h"
 #include "pnfs.h"
fs/nfsd/nfs4ctl.h new file +83 -0

83 lines not on this page · raw message

fs/nfsd/nfs4proc.c +1 -0
index 2aef7f7202b3..b7d745020fd1 100644
@@ -46,6 +46,7 @@
 #include "idmap.h"
 #include "cache.h"
 #include "xdr4.h"
+#include "nfs4ctl.h"
 #include "vfs.h"
 #include "current_stateid.h"
 #include "netns.h"
fs/nfsd/nfs4recover.c +1 -0
index d513971fb119..aee3a0b22d1c 100644
@@ -47,6 +47,7 @@
 #include <linux/nfsd/cld.h>
 
 #include "nfsd.h"
+#include "nfs4ctl.h"
 #include "state.h"
 #include "vfs.h"
 #include "netns.h"
fs/nfsd/nfs4state.c +1 -0
index a3bfcefa7bc9..e78d4fe5fbfb 100644
@@ -48,6 +48,7 @@
 #include <linux/nfs_ssc.h>
 
 #include "xdr4.h"
+#include "nfs4ctl.h"
 #include "xdr4cb.h"
 #include "vfs.h"
 #include "current_stateid.h"
fs/nfsd/nfsctl.c +1 -0
index 8521b648a970..4e5e083d8477 100644
@@ -24,6 +24,7 @@
 #include "idmap.h"
 #include "nfsd.h"
 #include "nfserr.h"
+#include "nfs4ctl.h"
 #include "netns.h"
 #include "stats.h"
 #include "cache.h"
fs/nfsd/nfsd.h +0 -63

73 lines not on this page · raw message

fs/nfsd/nfssvc.c +1 -0
index 7f6ffbe7be28..9cc8489978a3 100644
@@ -28,6 +28,7 @@
 
 #include "nfsd.h"
 #include "nfserr.h"
+#include "nfs4ctl.h"
 #include "cache.h"
 #include "vfs.h"
 #include "netns.h"
fs/nfsd/vfs.c +1 -0
index 25417bd94e71..fdfcd95971db 100644
@@ -44,6 +44,7 @@
 
 #include "nfsd.h"
 #include "nfserr.h"
+#include "nfs4ctl.h"
 #include "netns.h"
 #include "stats.h"
 #include "vfs.h"
Signature · 1 line
2.54.0
author maintainer
#6 lore raw

PATCH 6/6 NFSD: Move nfsd_v4client() out of nfsd.h

In reply to Chuck Lever

nfsd_v4client() is the last user in nfsd.h of XDR-defined item references. Once this helper moves out, <linux/nfs.h> and the other XDR-specific headers nfsd.h includes have nothing left to provide, and can be dropped.

---
 fs/nfsd/nfsd.h   | 5 +----
 fs/nfsd/nfssvc.c | 5 +++++
 2 files changed, 6 insertions(+), 4 deletions(-)
fs/nfsd/nfsd.h +1 -4
index 1cccf5a3c034..64315890eef5 100644
@@ -146,10 +146,7 @@ extern u64 nfsd_io_cache_write __read_mostly;
 
 extern int nfsd_max_blksize;
 
-static inline int nfsd_v4client(struct svc_rqst *rq)
-{
-	return rq && rq->rq_prog == NFS_PROGRAM && rq->rq_vers == 4;
-}
+bool nfsd_v4client(struct svc_rqst *rqstp);
 
 /*
  * lockd binding
fs/nfsd/nfssvc.c +5 -0
index 9cc8489978a3..c04ef9d180ce 100644
@@ -207,6 +207,11 @@ int nfsd_minorversion(struct nfsd_net *nn, u32 minorversion, enum vers_op change
 	return 0;
 }
 
+bool nfsd_v4client(struct svc_rqst *rqstp)
+{
+	return rqstp && rqstp->rq_prog == NFS_PROGRAM && rqstp->rq_vers == 4;
+}
+
 bool nfsd_net_try_get(struct net *net) __must_hold(rcu)
 {
 	struct nfsd_net *nn = net_generic(net, nfsd_net_id);
Signature · 1 line
2.54.0
maintainer Reviewed-by on the v1 series
#7 lore raw
In reply to Chuck Lever
Quoted 39 lines · Chuck Lever

Now that Neil's vfs_create() rework has been applied to nfsd-testing, I feel more comfortable sending along more of these clean-up patches. The goal is to reduce dependencies on single large individual headers that pull in items that are irrelevant in many cases.

Chuck Lever (6):
NFSD: Move XDR encoding helpers out of xdr4.h
NFSD: Move pre-xdr'ed status codes out of nfsd.h
NFSD: Remove two unused NFSv4 constants
NFSD: Relocate NFSv4-internal constants to state.h
NFSD: Evacuate NFSv4 entry-point prototypes from nfsd.h
NFSD: Move nfsd_v4client() out of nfsd.h

 fs/nfsd/blocklayout.c        |   1 +
 fs/nfsd/blocklayoutxdr.c     |  11 ++
 fs/nfsd/export.c             |   2 +
 fs/nfsd/filecache.c          |   1 +
 fs/nfsd/flexfilelayout.c     |   1 +
 fs/nfsd/flexfilelayoutxdr.c  |   1 +
 fs/nfsd/lockd.c              |   1 +
 fs/nfsd/nfs2acl.c            |   1 +
 fs/nfsd/nfs3acl.c            |   1 +
 fs/nfsd/nfs3proc.c           |   1 +
 fs/nfsd/nfs3xdr.c            |   1 +
 fs/nfsd/nfs4acl.c            |   1 +
 fs/nfsd/nfs4callback.c       |   1 +
 fs/nfsd/nfs4ctl.h            |  83 ++++++++++++
 fs/nfsd/nfs4idmap.c          |   1 +
 fs/nfsd/nfs4layouts.c        |   1 +
 fs/nfsd/nfs4proc.c           |   2 +
 fs/nfsd/nfs4recover.c        |   1 +
 fs/nfsd/nfs4state.c          |   2 +
 fs/nfsd/nfs4xdr.c            |  93 +++++++++++++
 fs/nfsd/nfscache.c           |   1 +
 fs/nfsd/nfsctl.c             |   2 +
 fs/nfsd/nfsd.h               | 236 +--------------------------------
 fs/nfsd/{nfsd.h => nfserr.h} | 248 +----------------------------------
 fs/nfsd/nfsfh.c              |   1 +
 fs/nfsd/nfsproc.c            |   1 +
Quoted 8 lines
 fs/nfsd/nfssvc.c             |   8 ++
 fs/nfsd/nfsxdr.c             |   1 +
 fs/nfsd/state.h              |  19 +++
 fs/nfsd/vfs.c                |   2 +
 fs/nfsd/xdr4.h               | 139 --------------------
 31 files changed, 250 insertions(+), 615 deletions(-)
 create mode 100644 fs/nfsd/nfs4ctl.h
 copy fs/nfsd/{nfsd.h => nfserr.h} (50%)

LGTM