summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-12-23 08:43:16 +0000
committermav <mav@FreeBSD.org>2013-12-23 08:43:16 +0000
commitc84160c1b25c50cb41c73db768aba34d5cb7c448 (patch)
tree53d88dbc677b8201f564c6e1429f6aee358e5792 /sys/nfsserver
parent276cb60bbc79440017dce590e0f0810118043fdf (diff)
downloadFreeBSD-src-c84160c1b25c50cb41c73db768aba34d5cb7c448.zip
FreeBSD-src-c84160c1b25c50cb41c73db768aba34d5cb7c448.tar.gz
Fix RPC server threads file handle affinity to work better with ZFS.
Instead of taking 8 specific bytes of file handle to identify file during RPC thread affitinity handling, use trivial hash of the full file handle. ZFS's struct zfid_short does not have padding field after the length field, as result, originally picked 8 bytes are loosing lower 16 bits of object ID, causing many false matches and unneeded requests affinity to same thread. This fix substantially improves NFS server latency and scalability in SPEC NFS benchmark by more flexible use of multiple NFS threads. Sponsored by: iXsystems, Inc.
Diffstat (limited to 'sys/nfsserver')
-rw-r--r--sys/nfsserver/nfs_fha_old.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/sys/nfsserver/nfs_fha_old.c b/sys/nfsserver/nfs_fha_old.c
index 82149b8..a928278 100644
--- a/sys/nfsserver/nfs_fha_old.c
+++ b/sys/nfsserver/nfs_fha_old.c
@@ -49,7 +49,7 @@ static void fhaold_init(void *foo);
static void fhaold_uninit(void *foo);
rpcproc_t fhaold_get_procnum(rpcproc_t procnum);
int fhaold_realign(struct mbuf **mb, int malloc_flags);
-int fhaold_get_fh(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos);
+int fhaold_get_fh(uint64_t *fh, int v3, struct mbuf **md, caddr_t *dpos);
int fhaold_is_read(rpcproc_t procnum);
int fhaold_is_write(rpcproc_t procnum);
int fhaold_get_offset(struct mbuf **md, caddr_t *dpos, int v3,
@@ -135,9 +135,33 @@ fhaold_realign(struct mbuf **mb, int malloc_flags)
}
int
-fhaold_get_fh(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos)
+fhaold_get_fh(uint64_t *fh, int v3, struct mbuf **md, caddr_t *dpos)
{
- return (nfsm_srvmtofh_xx(fh, v3, md, dpos));
+ u_int32_t *tl;
+ uint8_t *buf;
+ uint64_t t;
+ int fhlen, i;
+
+ if (v3) {
+ tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos);
+ if (tl == NULL)
+ return EBADRPC;
+ fhlen = fxdr_unsigned(int, *tl);
+ if (fhlen != 0 && fhlen != NFSX_V3FH)
+ return EBADRPC;
+ } else {
+ fhlen = NFSX_V2FH;
+ }
+ t = 0;
+ if (fhlen != 0) {
+ buf = nfsm_dissect_xx_nonblock(fhlen, md, dpos);
+ if (buf == NULL)
+ return EBADRPC;
+ for (i = 0; i < fhlen; i++)
+ t ^= ((uint64_t)buf[i] << (i & 7) * 8);
+ }
+ *fh = t;
+ return 0;
}
int
OpenPOWER on IntegriCloud