diff options
-rw-r--r-- | lib/fuse_i.h | 8 | ||||
-rw-r--r-- | lib/fuse_lowlevel.c | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/fuse_i.h b/lib/fuse_i.h index 1519ce0..2815a8a 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -196,7 +196,13 @@ int fuse_session_loop_mt_312(struct fuse_session *se, struct fuse_loop_config *c int fuse_loop_cfg_verify(struct fuse_loop_config *config); -#define FUSE_MAX_MAX_PAGES 256 +/* + * This can be changed dynamically on recent kernels through the + * /proc/sys/fs/fuse/max_pages_limit interface. + * + * Older kernels will always use the default value. + */ +#define FUSE_DEFAULT_MAX_PAGES_LIMIT 256 #define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32 /* room needed in buffer to accommodate header */ diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 824dbab..819e435 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2915,19 +2915,19 @@ static unsigned int get_max_pages(void) fd = open("/proc/sys/fs/fuse/max_pages_limit", O_RDONLY); if (fd < 0) - return FUSE_MAX_MAX_PAGES; + return FUSE_DEFAULT_MAX_PAGES_LIMIT; res = read(fd, buf, sizeof(buf) - 1); close(fd); if (res < 0) - return FUSE_MAX_MAX_PAGES; + return FUSE_DEFAULT_MAX_PAGES_LIMIT; buf[res] = '\0'; res = strtol(buf, NULL, 10); - return res < 0 ? FUSE_MAX_MAX_PAGES : res; + return res < 0 ? FUSE_DEFAULT_MAX_PAGES_LIMIT : res; } int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf) |