[Bug 271065] Kernel FUSE limits read() size by 64k/128k

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 25 Apr 2023 13:31:32 UTC

            Bug ID: 271065
           Summary: Kernel FUSE limits read() size by 64k/128k
           Product: Base System
           Version: 13.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: rozhuk.im@gmail.com

I am trying to increase sshfs file read speed from remote mount with RTT ~70+ms
and I need some help with kernel FUSE.

Read speed is limited by RTT and read chunk size, RTT can not be fixed by code
but we can increase read chunk size.

sshfs -o remember=30 -o auto_cache -o cache=yes -o kernel_cache -o
compression=yes -o max_write=67108864 -o max_read=67108864 -o dir_cache=yes -o
noatime root@somehost:/ /mnt/tmp -d -v -o debug --debug
dd if='/mnt/tmp/some_big.file' of=/dev/null bs=4m status=progress

unique: 14130, opcode: READ (15), nodeid: 850, insize: 80, pid: 4468
[01249] READ
[01250] READ
  [01247]           DATA   131076bytes (95ms)
  [01248]           DATA       22bytes (95ms)
   unique: 14130, success, outsize: 131088

If "sysctl vfs.maxbcachebuf=128k" then "unique: 14130, success, outsize:
131088" -> "unique: 14130, success, outsize: 262144". (sshfs hacked for read
This increase read speed ~twice, but not enough to utilize 100m link.
vfs.maxbcachebuf=512k or 1024k is ok for remote mount @ 100m link but if may be
too big for other FS mounted locally.

I found 64k limit in fuse_vfsop_mount(): "mp->mnt_stat.f_iosize =
Then I try to change it to "maxphys" - system panics or hang on read() from
sshfs mount. Looks like more changes required due to "fuse_iosize() { return
mp->mnt_stat.f_iosize; }" used in many places, probably some of them expect
only "maxbcachebuf".

IMHO mp->mnt_stat.f_iosize = maxphys or maxphys/2 will be better default.
Also if "max_read" is set and "maxbcachebuf < max_read < maxphys" then it can
be used.

Can some one help with this?

You are receiving this mail because:
You are the assignee for the bug.