• Jakob Unterwurzacher's avatar
    fuse: Increase MAX_KERNEL_WRITE to 1 MiB & enable CAP_MAX_PAGES · 265a3926
    Jakob Unterwurzacher authored
    Kernel 4.20 allows writes & reads up to 1 MiB (before: 128 kiB)
    via CAP_MAX_PAGES & MaxPages.
    
    Instead of exposing MaxPages in the API, we follow what libfuse
    does, and calculate MaxPages from MaxWrite (rounding up).
    
    Contrary to what libfuse does, we also set max_read to the same
    value as MaxWrite. This prevents reads getting larger than writes
    due to the rounding-up for MaxPages, which is unexpected. This
    also changes the default behavoir of go-fuse, which was 64 kiB
    writes, but 128 kiB for reads. Now it is 128 kiB for both.
    
    The tests are implemented in the fs package because it's
    easier there. They also test MaxReadAhead.
    
    Tested on Linux 4.19.0 and Linux 6.1.7 via all.bash,
    and on 6.1.7 also via the gocryptfs test suite.
    
    Supersedes https://github.com/hanwen/go-fuse/pull/347
    
    Change-Id: I5a1d4ee91945155c367888da7a90814a24a9ee6e
    265a3926
api.go 15.1 KB