From: Goswin v. B. <gos...@we...> - 2011-05-15 01:06:46
|
Han-Wen Nienhuys <ha...@gm...> writes: > On Sat, May 14, 2011 at 6:13 PM, Michael McTernan > <Mic...@cs...> wrote: >> So I'm wondering if it is possible to make FUSE use synchronous reads >> within a single file context (i.e. lock per struct fuse_file_info) but >> multi-threading across the file system? >> >> Or maybe there is some other simple solution I'm overlooking? > > Cache the contents of the file after decoding, so the reads hit the > cache and out-of-order reads do not require reinit of the decoder. Or protect the file with a lock and queue up requests in-order. That means if you get requests for block 0, 2 and 1 then 0 takes the lock and runs, 2 queues itself up, 1 queues itself up BEFORE 2. When 0 finishes decoding then 1 is done next. You will loose some parallelity there but decoding the same file in multiple threads is probably not too smart (unless the reads are sufficiently distant from each other). MfG Goswin |