Files
sparsebundlefs-mirror/sparsebundlefs.cpp
Tor Arne Vestbø 4abe68dccd Implement zero-copy reads (read_buf) for FUSE 2.9 and above
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.
2012-10-14 21:46:47 +02:00

12 KiB