Hi, While using sysutils/usmb on OpenBSD and Linux I noticed read and write performance issues. Below are simple changes to improve this a lot.
Read performance: In the file options.c function build_fuse_args there is: static char MAX_READ[] = "max_read=32768"; This FUSE option to limitate reads can be safely removed. In the file usmb_file.c function usmb_read there is also: assert (32768 >= len); This (debug) assertion should be removed then also. Write performance: In the file usmb_file.c function usmb_write has a vague comment about a write limitation and: bytes = write_fn (ctx, file, (char *)buff, (len > 32768) ? 32768 : len); This can be safely changed to: bytes = write_fn (ctx, file, (char *)buff, len); Read and write performance: By default on OpenBSD exposes 512 bytes blocksizes for devices using FUSE. Functions using the libc stdio FILE* interface (fread, fwrite, etc) use struct stat.st_blksize for their buffering. Using ktrace it was noticed this performed reads with 512 bytes buffers and crippled network performance for programs using this interface for the mounted FUSE filesystem. Looking at some of the FUSE ports in OpenBSD, for example sysutils/sshfs-fuse and sysutils/curlftpfs, they set their standard st.st_blksize to 4096 bytes. This could be changed in usmb also, to 32KB in this case (I like big buffers and I cannot lie): static bool change_blksiz(struct stat *st) { if (st == NULL) return false; if (S_ISREG(st->st_mode)) { st->st_blksize = 32768; return true; } return false; } ... and in the FUSE op/callback function usmb_getattr and usmb_fgetattr this can be added: change_blksiz(st); This caused a funny behaviour, this was much slower: sha256 /mnt/share/somefile compared to: cat /mnt/share/somefile | sha256 ... because sha256 uses fread, but cat uses raw read(2) calls and a fallback buffer of BUFSIZ (1024 bytes) :) A question about using ports that use FUSE: In the following commit the sysctl kern.usermount=1 was removed: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/kern/kern_sysctl.c?rev=1.306&content-type=text/x-cvsweb-markup What is the alternative to run FUSE safely as non-root now? It seems ports like sshfs, curlftps etc cannot run as a user now? susmb fork: For my use-case I have made a fork with these and more changes, they are described here: https://git.codemadness.org/susmb/file/README.html#l71 Namely unveil(2) support to limit writing only to the mountpoint and the FUSE driver, priviledge-dropping support, no XML configuration but command-line options to configure it and many code and usage simplifications. Feel free to use the above changes into usmb if you want. -- Kind regards, Hiltjo