mirror of
https://github.com/torarnv/sparsebundlefs.git
synced 2026-02-26 18:35:50 +01:00
FUSE 2.9 added support for zero copy reads/writes through two new callbacks, read_buf and write_buf. We now imeplement read_buf, which iterates over the bands using the generic code, but instead of opening and reading the content of the band into memory, we just open the file and pass a structure back to FUSE with the file descriptor, size, and offset, and FUSE will then use this on the kernel side if possible (using splice on GNU/Linux). For padding with zeroes we open /dev/zero and treat it as any other file. Since FUSE does not provide a callback when it's done with the buffers there's no way for us to know when to close the bands we opened. To work around this we keep the files open until either the main image (dmg) file has been closed, or we run out of file descriptors, at which point we gc the open files and continue.
12 KiB
12 KiB