From: Carlos M. <cma...@re...> - 2017-04-20 12:53:16
|
Currently libfuse has a hardcoded buffer limit to 128kib, while fuse kernel module has a limit up to 32 pages. This patch changes buffer limit to match the current page size, instead of assuming 4096 bytes pages, enabling architectures with bigger pages to use larger buffers, improving performance. Also, add a new macro (HEADER_SIZE) to specify the space needed to accommodate the header, making it easier to understand why those extra 4096 bytes are needed Signed-off-by: Carlos Maiolino <cma...@re...> --- lib/fuse_lowlevel.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index a960123..1ece58c 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2767,7 +2767,10 @@ restart: return res; } -#define MIN_BUFSIZE 0x21000 +#define KERNEL_BUF_PAGES 32 + +/* room needed in buffer to accommodate header */ +#define HEADER_SIZE 0x1000 struct fuse_session *fuse_session_new(struct fuse_args *args, const struct fuse_lowlevel_ops *op, @@ -2829,8 +2832,7 @@ struct fuse_session *fuse_session_new(struct fuse_args *args, if (se->debug) fprintf(stderr, "FUSE library version: %s\n", PACKAGE_VERSION); - se->bufsize = getpagesize() + 0x1000; - se->bufsize = se->bufsize < MIN_BUFSIZE ? MIN_BUFSIZE : se->bufsize; + se->bufsize = KERNEL_BUF_PAGES * getpagesize() + HEADER_SIZE; list_init_req(&se->list); list_init_req(&se->interrupts); -- 2.9.3 |