Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src Pull up following revision(s) (requested by manu in ticke...
details: https://anonhg.NetBSD.org/src/rev/e7af27b11a73
branches: netbsd-7
changeset: 799997:e7af27b11a73
user: snj <snj%NetBSD.org@localhost>
date: Tue Nov 01 19:49:04 2016 +0000
description:
Pull up following revision(s) (requested by manu in ticket #1266):
lib/libperfuse/fuse.h: revision 1.7
lib/libperfuse/libperfuse.3: revision 1.4, 1.5
lib/libperfuse/perfuse.c: revision 1.38-1.40
lib/libperfuse/perfuse_if.h: revision 1.21, 1.22
usr.sbin/perfused/msg.c: revision 1.23, 1.24
usr.sbin/perfused/perfused.8: revision 1.12
Make FUSE socket buffer tunable
When dealing with high I/O throughput, we could run out of buffer
space if the filesystem was not consuming requests fast enough.
Here we slightly raise the buffer size, and we make it tunable
through the PERFUSE_BUFSIZE environment variable so that we can
cope with higher requirement later.
While there, document PERFUSE_OPTIONS environment variable.
--
make this compile again, and simplify.
--
Sort sections. new sentence, new line. Whitespace.
--
make the env stuff visible.
--
remove dup function
diffstat:
lib/libperfuse/fuse.h | 6 +++---
lib/libperfuse/libperfuse.3 | 18 +++++++++++++++++-
lib/libperfuse/perfuse.c | 33 +++++++++++++++++++++++++++------
lib/libperfuse/perfuse_if.h | 12 ++++++++++--
usr.sbin/perfused/msg.c | 10 ++++------
usr.sbin/perfused/perfused.8 | 8 +++++++-
6 files changed, 68 insertions(+), 19 deletions(-)
diffs (219 lines):
diff -r 201a1ba1d1b4 -r e7af27b11a73 lib/libperfuse/fuse.h
--- a/lib/libperfuse/fuse.h Tue Nov 01 19:30:44 2016 +0000
+++ b/lib/libperfuse/fuse.h Tue Nov 01 19:49:04 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fuse.h,v 1.5.18.1 2014/11/05 18:11:30 snj Exp $ */
+/* $NetBSD: fuse.h,v 1.5.18.2 2016/11/01 19:49:04 snj Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -34,8 +34,8 @@
#define FUSE_UNKNOWN_FH (uint64_t)0
#ifndef FUSE_BUFSIZE
-#define FUSE_MIN_BUFSIZE 0x21000
-#define FUSE_PREF_BUFSIZE (sysconf(_SC_PAGESIZE) + 0x1000)
+#define FUSE_MIN_BUFSIZE ((size_t)0x21000)
+#define FUSE_PREF_BUFSIZE ((size_t)(sysconf(_SC_PAGESIZE) + 0x1000))
#define FUSE_BUFSIZE MAX(FUSE_PREF_BUFSIZE /* CONSTCOND */, FUSE_MIN_BUFSIZE)
#endif /* FUSE_BUFSIZE */
diff -r 201a1ba1d1b4 -r e7af27b11a73 lib/libperfuse/libperfuse.3
--- a/lib/libperfuse/libperfuse.3 Tue Nov 01 19:30:44 2016 +0000
+++ b/lib/libperfuse/libperfuse.3 Tue Nov 01 19:49:04 2016 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: libperfuse.3,v 1.3 2011/05/10 12:14:37 njoly Exp $
+.\" $NetBSD: libperfuse.3,v 1.3.22.1 2016/11/01 19:49:04 snj Exp $
.\"
.\" Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
.\"
@@ -105,6 +105,22 @@
returns a file descriptor to the
.Pa /dev/fuse
socket on success, and causes exit on failure.
+.Sh ENVIRONMENT
+.Bl -tag -width Er
+.It Ev PERFUSE_OPTIONS
+Comma-separated values controlling the usage of some FUSE methods.
+Allowed values are
+.Li enable_access ,
+.Li disable_access ,
+.Li enable_creat ,
+.Li disable_creat .
+.It Ev PERFUSE_BUFSIZE
+Set the socket buffer sizes used for communication with the filesystem.
+This should be raised as operation throughput requires it.
+Default is
+.Li 2162688
+bytes, which is enough to queue 16 FUSE packets of maximum 132 kB length.
+.El
.\".Sh ERRORS
.\".Fn perfuse_mount
.\"will fail when one of the following occurs:
diff -r 201a1ba1d1b4 -r e7af27b11a73 lib/libperfuse/perfuse.c
--- a/lib/libperfuse/perfuse.c Tue Nov 01 19:30:44 2016 +0000
+++ b/lib/libperfuse/perfuse.c Tue Nov 01 19:49:04 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perfuse.c,v 1.31.10.5 2015/08/06 21:52:13 snj Exp $ */
+/* $NetBSD: perfuse.c,v 1.31.10.6 2016/11/01 19:49:04 snj Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -32,6 +32,7 @@
#include <string.h>
#include <errno.h>
#include <puffs.h>
+#include <inttypes.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/resource.h>
@@ -52,7 +53,6 @@
static struct perfuse_state *init_state(void);
static int get_fd(const char *);
-
static struct perfuse_state *
init_state(void)
{
@@ -146,6 +146,25 @@
}
+uint32_t
+perfuse_bufvar_from_env(const char *name, uint32_t defval)
+{
+ char valstr[1024];
+ int e;
+ uint32_t retval;
+
+ if (getenv_r(name, valstr, sizeof(valstr)) == -1)
+ return defval;
+
+ retval = (uint32_t)strtoi(valstr, NULL, 0, 0, UINT32_MAX, &e);
+ if (!e)
+ return retval;
+
+ DWARNC(e, "conversion from `%s' to uint32_t failed, using %u",
+ valstr, defval);
+ return defval;
+}
+
int
perfuse_open(const char *path, int flags, mode_t mode)
{
@@ -180,10 +199,11 @@
}
/*
- * Set a buffer lentgh large enough so that any FUSE packet
+ * Set a buffer lentgh large enough so that enough FUSE packets
* will fit.
*/
- opt = (uint32_t)FUSE_BUFSIZE;
+ opt = perfuse_bufvar_from_env("PERFUSE_BUFSIZE",
+ (uint32_t)(16 * FUSE_BUFSIZE));
optlen = sizeof(opt);
if (setsockopt(sv[0], SOL_SOCKET, SO_SNDBUF, &opt, optlen) != 0)
DWARN("%s: setsockopt SO_SNDBUF to %d failed", __func__, opt);
@@ -211,10 +231,11 @@
}
/*
- * Set a buffer lentgh large enough so that any FUSE packet
+ * Set a buffer lentgh large enough so that enough FUSE packets
* will fit.
*/
- opt = (uint32_t)(4 * FUSE_BUFSIZE);
+ opt = perfuse_bufvar_from_env("PERFUSE_BUFSIZE",
+ (uint32_t)(16 * FUSE_BUFSIZE));
optlen = sizeof(opt);
if (setsockopt(sv[0], SOL_SOCKET, SO_SNDBUF, &opt, optlen) != 0)
DWARN("%s: setsockopt SO_SNDBUF to %d failed", __func__, opt);
diff -r 201a1ba1d1b4 -r e7af27b11a73 lib/libperfuse/perfuse_if.h
--- a/lib/libperfuse/perfuse_if.h Tue Nov 01 19:30:44 2016 +0000
+++ b/lib/libperfuse/perfuse_if.h Tue Nov 01 19:49:04 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perfuse_if.h,v 1.20 2012/07/21 05:49:42 manu Exp $ */
+/* $NetBSD: perfuse_if.h,v 1.20.10.1 2016/11/01 19:49:04 snj Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -103,13 +103,20 @@
} while (0 /* CONSTCOND */)
#define DWARN(fmt, ...) do { \
- \
if (perfuse_diagflags & PDF_SYSLOG) \
syslog(LOG_WARNING, fmt ": %m", ## __VA_ARGS__); \
\
warn(fmt, ## __VA_ARGS__); \
} while (0 /* CONSTCOND */)
+#define DWARNC(e, fmt, ...) do { \
+ if (perfuse_diagflags & PDF_SYSLOG) { \
+ errno = e; \
+ syslog(LOG_WARNING, fmt ": %m", ## __VA_ARGS__); \
+ } \
+ warnc(e, fmt, ## __VA_ARGS__); \
+} while (0 /* CONSTCOND */)
+
/*
* frame handling callbacks
*/
@@ -212,5 +219,6 @@
int perfuse_unmount(struct puffs_usermount *);
void perfuse_trace_dump(struct puffs_usermount *, FILE *);
void perfuse_fsreq(struct puffs_usermount *, perfuse_msg_t *);
+uint32_t perfuse_bufvar_from_env(const char *, uint32_t);
#endif /* _PERFUSE_IF_H */
diff -r 201a1ba1d1b4 -r e7af27b11a73 usr.sbin/perfused/msg.c
--- a/usr.sbin/perfused/msg.c Tue Nov 01 19:30:44 2016 +0000
+++ b/usr.sbin/perfused/msg.c Tue Nov 01 19:49:04 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.c,v 1.21.10.1 2014/08/24 08:42:06 martin Exp $ */
+/* $NetBSD: msg.c,v 1.21.10.2 2016/11/01 19:49:04 snj Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -80,15 +80,13 @@
/*
* Set a buffer lentgh large enough so that a few FUSE packets
* will fit.
- * XXX We will have to find how many packets we need
*/
- opt = 4 * FUSE_BUFSIZE;
+ opt = perfuse_bufvar_from_env("PERFUSE_BUFSIZE", 16 * FUSE_BUFSIZE);
if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(opt)) != 0)
- DWARN("%s: setsockopt SO_SNDBUF to %d failed", __func__, opt);
+ DWARN("%s: setsockopt SO_SNDBUF = %d failed", __func__, opt);
- opt = 4 * FUSE_BUFSIZE;
if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, sizeof(opt)) != 0)
- DWARN("%s: setsockopt SO_RCVBUF to %d failed", __func__, opt);
+ DWARN("%s: setsockopt SO_RCVBUF = %d failed", __func__, opt);
/*
* Request peer credentials
diff -r 201a1ba1d1b4 -r e7af27b11a73 usr.sbin/perfused/perfused.8
--- a/usr.sbin/perfused/perfused.8 Tue Nov 01 19:30:44 2016 +0000
+++ b/usr.sbin/perfused/perfused.8 Tue Nov 01 19:49:04 2016 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: perfused.8,v 1.11 2012/01/29 11:32:23 wiz Exp $
+.\" $NetBSD: perfused.8,v 1.11.18.1 2016/11/01 19:49:04 snj Exp $
.\"
.\" Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
.\"
@@ -118,6 +118,12 @@
Enable debug output only when receiving
.Li SIGINFO .
.El
+.Sh ENVIRONMENT
+See
+.Xr libperfuse 3
+for environment variables affecting
+.Nm
+behavior.
.Sh SIGNALS
.Bl -tag -width indent
.It Dv SIGINFO
Home |
Main Index |
Thread Index |
Old Index