Initialize session buffer size to value set by sysctl
authorJoanne Koong <joannelkoong@gmail.com>
Thu, 26 Sep 2024 00:49:56 +0000 (17:49 -0700)
committerBernd Schubert <bernd.schubert@fastmail.fm>
Sat, 28 Sep 2024 10:24:25 +0000 (12:24 +0200)
commit78eeae60bb5a978eae4c3ce705c58189b762a24b
tree3e08954d5ecf991291622448c0dd38ec2b4d0217
parentd637fe6f3ebda69f505b531deff33f5b2374a9e1
Initialize session buffer size to value set by sysctl

Currently in libfuse, the buffer size for a fuse session is
capped at 1 MiB on a 4k page system. A recent patch
upstream [1] was merged that allows the max number of pages
per fuse request to be dynamically configurable through the
/proc/sys interface (/proc/sys/fs/fuse/max_pages_limit).

This commit adds support for this on the libfuse side to set
the fuse session buffer to take into account the max pages
limit set in /proc/sys/fs/fuse/max_pages_limit. If this
sysctl does not exist (eg older kernels), it will default to
old behavior (using FUSE_MAX_MAX_PAGES (256) as the max pages
limit). This allows for things like bigger write buffers per
request.

[1] https://lore.kernel.org/linux-fsdevel/20240923171311.1561917-1-joannelkoong@gmail.com/T/#t
lib/fuse_lowlevel.c