Hmm if I answer my own questions I might as well get it right for those googling later! :)
the 4K reads and writes are defaults; if you specify -obig_writes etc when mounting your FUSE system then they are no longer restricted to 4KB.
If your FS can handle non-page-sized reads and writes, I recommend this option - it led to a 30% speedup for my FS.
My FS is still slow, and its all in context switches; makes you wonder about microkernels, or rather what those OSes that have microkernels do to speed up IO and why Linux doesn't do it for FUSE...
--- On Fri, 9/7/10, will <varfar@...> wrote:
> From: will <varfar@...>
> Subject: Re: [fuse-devel] kernel_cache
> To: fuse-devel@...
> Date: Friday, 9 July, 2010, 22:38
> To answer my own question:
> 1) fread was returning 0 because I had the wrong mode and
> wasn't seeking - that was my bug
> 2) the buffer cache works in pages. If you write 4
> bytes to a file, and you want to read 4 bytes from a file,
> the OS will actually ask to read a page (4K).
> Which leaves me wondering:
> Is there a strategy to get small / not-page-aligned reads
> and writes to cache nicely without hitting my FUSE FS?
> --- On Fri, 9/7/10, will <varfar@...>
> > From: will <varfar@...>
> > Subject: [fuse-devel] kernel_cache
> > To: fuse-devel@...
> > Date: Friday, 9 July, 2010, 1:46
> > I am passing -okernel_cache as an
> > option to my simple python-fuse system (latest ubuntu
> > package, 2:0.2-2)
> > If the file is created, written to and closed, other
> > will still cause reads (and for 4096 bytes, even if
> the file
> > is 4 bytes and the fread() call specifies exactly 4
> > If the file is created, written to and then seeked
> > read, the read is not hitting my fuse fs, but the
> fread() is
> > returning 0 bytes.
> > What's going on, and how can I get kernel_cache to
> > that all reads from all opens of a file are resolved
> > vfs buffer caches if at all possible?
From: Goswin von Brederlow <goswin-v-b@we...> - 2010-07-12 19:42:02
will <varfar@...> writes:
> My FS is still slow, and its all in context switches; makes you wonder
> about microkernels, or rather what those OSes that have microkernels
> do to speed up IO and why Linux doesn't do it for FUSE...
Well, Linux uses (as of the time the comparison was done) 13000 cycles
for a context switch while the L4 Mikrokernel uses 13 cycles for a
simple switch for inter process communications.
If you can do 1000 context switches in the time linux does one they
really don't matter any more.