Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102963842
D38742.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D38742.diff
View Options
diff --git a/sys/fs/nfsserver/nfs_fha_new.h b/sys/fs/nfsserver/nfs_fha_new.h
--- a/sys/fs/nfsserver/nfs_fha_new.h
+++ b/sys/fs/nfsserver/nfs_fha_new.h
@@ -95,8 +95,6 @@
struct fha_params {
struct fha_hash_slot fha_hash[FHA_HASH_SIZE];
- struct sysctl_ctx_list sysctl_ctx;
- struct sysctl_oid *sysctl_tree;
struct fha_ctls ctls;
char server_name[32];
};
diff --git a/sys/fs/nfsserver/nfs_fha_new.c b/sys/fs/nfsserver/nfs_fha_new.c
--- a/sys/fs/nfsserver/nfs_fha_new.c
+++ b/sys/fs/nfsserver/nfs_fha_new.c
@@ -56,9 +56,41 @@
static void fha_extract_info(struct svc_req *req,
struct fha_info *i);
-NFSD_VNET_DEFINE_STATIC(struct fha_params *, fhanew_softc);
+NFSD_VNET_DEFINE_STATIC(struct fha_params, fhanew_softc) = {
+ .ctls = {
+ .enable = FHA_DEF_ENABLE,
+ .read = FHA_DEF_READ,
+ .write = FHA_DEF_WRITE,
+ .bin_shift = FHA_DEF_BIN_SHIFT,
+ .max_nfsds_per_fh = FHA_DEF_MAX_NFSDS_PER_FH,
+ .max_reqs_per_nfsd = FHA_DEF_MAX_REQS_PER_NFSD,
+ },
+};
SYSCTL_DECL(_vfs_nfsd);
+static SYSCTL_NODE(_vfs_nfsd, OID_AUTO, fha, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
+ "NFS File Handle Affinity (FHA)");
+SYSCTL_UINT(_vfs_nfsd, OID_AUTO, enable, CTLFLAG_VNET | CTLFLAG_RWTUN,
+ &NFSD_VNET_NAME(fhanew_softc.ctls.enable), 0,
+ "Enable NFS File Handle Affinity (FHA)");
+SYSCTL_UINT(_vfs_nfsd, OID_AUTO, read, CTLFLAG_VNET | CTLFLAG_RWTUN,
+ &NFSD_VNET_NAME(fhanew_softc.ctls.read), 0,
+ "Enable NFS FHA read locality");
+SYSCTL_UINT(_vfs_nfsd, OID_AUTO, write, CTLFLAG_VNET | CTLFLAG_RWTUN,
+ &NFSD_VNET_NAME(fhanew_softc.ctls.write), 0,
+ "Enable NFS FHA write locality");
+SYSCTL_UINT(_vfs_nfsd, OID_AUTO, bin_shift, CTLFLAG_VNET | CTLFLAG_RWTUN,
+ &NFSD_VNET_NAME(fhanew_softc.ctls.bin_shift), 0,
+ "Maximum locality distance 2^(bin_shift) bytes");
+SYSCTL_UINT(_vfs_nfsd, OID_AUTO, max_nfsds_per_fh, CTLFLAG_VNET | CTLFLAG_RWTUN,
+ &NFSD_VNET_NAME(fhanew_softc.ctls.max_nfsds_per_fh), 0, "Maximum nfsd "
+ "threads that should be working on requests for the same file handle");
+SYSCTL_UINT(_vfs_nfsd, OID_AUTO, max_reqs_per_nfsd,
+ CTLFLAG_VNET | CTLFLAG_RWTUN,
+ &NFSD_VNET_NAME(fhanew_softc.ctls.max_reqs_per_nfsd), 0, "Maximum requests "
+ "that single nfsd thread should be working on at any time");
+SYSCTL_PROC(_vfs_nfsd, OID_AUTO, fhe_stats, CTLFLAG_VNET | CTLTYPE_STRING |
+ CTLFLAG_RD | CTLFLAG_MPSAFE, 0, 0, fhenew_stats_sysctl, "A", "");
extern int newnfs_nfsv3_procid[];
@@ -71,75 +103,13 @@
struct fha_params *softc;
int i;
- NFSD_VNET(fhanew_softc) = malloc(sizeof(struct fha_params), M_TEMP,
- M_WAITOK | M_ZERO);
- softc = NFSD_VNET(fhanew_softc);
+ softc = &NFSD_VNET(fhanew_softc);
snprintf(softc->server_name, sizeof(softc->server_name),
FHANEW_SERVER_NAME);
- /*
- * Initialize the sysctl context list for the fha module.
- */
- sysctl_ctx_init(&softc->sysctl_ctx);
- if (IS_DEFAULT_VNET(curvnet)) {
- softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
- SYSCTL_STATIC_CHILDREN(_vfs_nfsd), OID_AUTO, "fha",
- CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "NFS File Handle Affinity (FHA)");
- if (softc->sysctl_tree == NULL) {
- printf("%s: unable to allocate sysctl tree\n", __func__);
- return;
- }
- }
-
for (i = 0; i < FHA_HASH_SIZE; i++)
mtx_init(&softc->fha_hash[i].mtx, "fhalock", NULL, MTX_DEF);
-
- /*
- * Set the default tuning parameters.
- */
- softc->ctls.enable = FHA_DEF_ENABLE;
- softc->ctls.read = FHA_DEF_READ;
- softc->ctls.write = FHA_DEF_WRITE;
- softc->ctls.bin_shift = FHA_DEF_BIN_SHIFT;
- softc->ctls.max_nfsds_per_fh = FHA_DEF_MAX_NFSDS_PER_FH;
- softc->ctls.max_reqs_per_nfsd = FHA_DEF_MAX_REQS_PER_NFSD;
-
- /*
- * Add sysctls so the user can change the tuning parameters.
- */
- if (IS_DEFAULT_VNET(curvnet)) {
- SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
- OID_AUTO, "enable", CTLFLAG_RWTUN,
- &softc->ctls.enable, 0, "Enable NFS File Handle Affinity (FHA)");
-
- SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
- OID_AUTO, "read", CTLFLAG_RWTUN,
- &softc->ctls.read, 0, "Enable NFS FHA read locality");
-
- SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
- OID_AUTO, "write", CTLFLAG_RWTUN,
- &softc->ctls.write, 0, "Enable NFS FHA write locality");
-
- SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
- OID_AUTO, "bin_shift", CTLFLAG_RWTUN,
- &softc->ctls.bin_shift, 0,
- "Maximum locality distance 2^(bin_shift) bytes");
-
- SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
- OID_AUTO, "max_nfsds_per_fh", CTLFLAG_RWTUN,
- &softc->ctls.max_nfsds_per_fh, 0, "Maximum nfsd threads that "
- "should be working on requests for the same file handle");
-
- SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
- OID_AUTO, "max_reqs_per_nfsd", CTLFLAG_RWTUN,
- &softc->ctls.max_reqs_per_nfsd, 0, "Maximum requests that "
- "single nfsd thread should be working on at any time");
-
- SYSCTL_ADD_OID(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
- OID_AUTO, "fhe_stats", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
- 0, 0, fhenew_stats_sysctl, "A", "");
- }
}
static void
@@ -148,12 +118,10 @@
struct fha_params *softc;
int i;
- softc = NFSD_VNET(fhanew_softc);
+ softc = &NFSD_VNET(fhanew_softc);
- sysctl_ctx_free(&softc->sysctl_ctx);
for (i = 0; i < FHA_HASH_SIZE; i++)
mtx_destroy(&softc->fha_hash[i].mtx);
- free(softc, M_TEMP);
}
static rpcproc_t
@@ -567,7 +535,7 @@
struct fha_hash_entry *fhe;
NFSD_CURVNET_SET(NFSD_TD_TO_VNET(curthread));
- softc = NFSD_VNET(fhanew_softc);
+ softc = &NFSD_VNET(fhanew_softc);
/* Check to see whether we're enabled. */
if (softc->ctls.enable == 0)
goto thist;
@@ -665,8 +633,7 @@
sbuf_new(&sb, NULL, 65536, SBUF_FIXEDLEN);
- NFSD_CURVNET_SET(NFSD_TD_TO_VNET(curthread));
- softc = NFSD_VNET(fhanew_softc);
+ softc = &NFSD_VNET(fhanew_softc);
for (i = 0; i < FHA_HASH_SIZE; i++)
if (!LIST_EMPTY(&softc->fha_hash[i].list))
break;
@@ -709,7 +676,6 @@
}
out:
- NFSD_CURVNET_RESTORE();
sbuf_trim(&sb);
sbuf_finish(&sb);
error = sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 6:41 AM (21 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14732311
Default Alt Text
D38742.diff (6 KB)
Attached To
Mode
D38742: nfsd: use static memory for per-vnet struct fha_params
Attached
Detach File
Event Timeline
Log In to Comment