Skip to content

Commit

Permalink
Change FUSE_MAX_MAX_PAGES to FUSE_DEFAULT_MAX_PAGES_LIMIT
Browse files Browse the repository at this point in the history
A recent upstream patch [1] changed FUSE_MAX_MAX_PAGES to
FUSE_DEFAULT_MAX_PAGES_LIMIT.

Update libfuse to use FUSE_DEFAULT_MAX_PAGES_LIMIT as well
instead of FUSE_MAX_MAX_PAGES.

[1] https://lore.kernel.org/linux-fsdevel/[email protected]/T/#t
  • Loading branch information
joannekoong authored and bsbernd committed Sep 28, 2024
1 parent 78eeae6 commit 9069ad9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion lib/fuse_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions lib/fuse_lowlevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9069ad9

Please sign in to comment.