As the post suggests, I'm having some issues with Fuse and perl, namely the write_buffer size. Now, this could just be a Fuse issue, and if it is I'd ask a mod to move this, but I don't think it is.
The background;
Firstly, my implementation is working, and working well. I'm getting reasonable consistency in my read/writes, even with different sizes, and so I'm pretty sure my perl is working well (Which is why I haven't posted any of it, I can if you need).
I've implemented a very simple, bog standard filesystem with hashrefs, and data structures, all looks good. The problem is that the writes are being done in 4096 blocks; the Fuse standard.
Because this is the fuse standard, I did a grep for the write size:
Code:
root@jcmain:~# !1810
grep -inH max_write `locate fuse` 2>/dev/null
/usr/include/fuse/fuse_common.h:105: unsigned max_write;
/usr/include/linux/fuse.h:363: __u32 max_write;
Binary file /usr/lib/libfuse.a matches
Binary file /usr/lib/libfuse.so matches
Binary file /usr/lib/libfuse.so.2 matches
Binary file /usr/lib/libfuse.so.2.7.4 matches
/usr/src/linux-2.6.30-custom/debian/linux-headers-2.6.30-custom/usr/src/linux-headers-2.6.30-custom/include/linux/fuse.h:401: __u32 max_write;
/usr/src/linux-2.6.30-custom/fs/fuse/file.c:786: bytes = min_t(size_t, bytes, fc->max_write - count);
/usr/src/linux-2.6.30-custom/fs/fuse/file.c:823: } while (iov_iter_count(ii) && count < fc->max_write &&
/usr/src/linux-2.6.30-custom/fs/fuse/file.c:987: size_t nmax = write ? fc->max_write : fc->max_read;
/usr/src/linux-2.6.30-custom/fs/fuse/fuse_i.h:322: unsigned max_write;
/usr/src/linux-2.6.30-custom/fs/fuse/inode.c:763: fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
/usr/src/linux-2.6.30-custom/fs/fuse/inode.c:764: fc->max_write = max_t(unsigned, 4096, fc->max_write);
/usr/src/linux-2.6.30-custom/include/linux/fuse.h:401: __u32 max_write;
/usr/src/linux-2.6.32.8/fs/fuse/cuse.c:321: fc->max_write = max_t(unsigned, arg->max_write, 4096);
/usr/src/linux-2.6.32.8/fs/fuse/file.c:819: bytes = min_t(size_t, bytes, fc->max_write - count);
/usr/src/linux-2.6.32.8/fs/fuse/file.c:859: } while (iov_iter_count(ii) && count < fc->max_write &&
/usr/src/linux-2.6.32.8/fs/fuse/file.c:1023: size_t nmax = write ? fc->max_write : fc->max_read;
/usr/src/linux-2.6.32.8/fs/fuse/fuse_i.h:330: unsigned max_write;
/usr/src/linux-2.6.32.8/fs/fuse/inode.c:831: fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
/usr/src/linux-2.6.32.8/fs/fuse/inode.c:832: fc->max_write = max_t(unsigned, 4096, fc->max_write);
/usr/src/linux-2.6.32.8/include/linux/fuse.h:456: __u32 max_write;
/usr/src/linux-2.6.32.8/include/linux/fuse.h:474: __u32 max_write;
/usr/src/linux-headers-2.6.26-2-686/include/linux/fuse.h:363: __u32 max_write;
/usr/src/linux-headers-2.6.26-2-common/include/linux/fuse.h:363: __u32 max_write;
root@jcmain:~# uname -a
Linux jcmain 2.6.30-custom #1 SMP Fri Jun 12 22:15:25 BST 2009 i686 GNU/Linux
and found the module which referenced 4096 on my kernel; /usr/src/linux-2.6.30-custom/fs/fuse/inode.c
I changed 4096 to 131072 (I forget why that number, I think I saw it somewhere whilst researching this, but no idea where/why), recompiled the module, unloaded the old fuse module and loaded this one. I was even convinced it'd worked:
Code:
jc@jcmain:~/steg$ sudo perl fs_simple.pl
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56
INIT: 7.11
flags=0x0000003b
max_readahead=0x00020000
INIT: 7.8
flags=0x00000000
max_readahead=0x00020000
max_write=0x00020000
unique: 1, error: 0 (Success), outsize: 40
which as my python prompt tells me:
Code:
>>> int( 0x00020000 )
131072
Which tells me that perl it's self has set the 4096 from somewhere else. Its not, however, built into Fuse.pm or Fuse::Simple.pm - which is what I'm using:
Code:
jc@jcmain:/usr/lib/perl5$ grep 4096 Fuse.pm
jc@jcmain:/usr/lib/perl5$
<snip>
jc@jcmain:/usr/local/share/perl/5.10.0/Fuse$ grep 4096 Simple.pm
jc@jcmain:/usr/local/share/perl/5.10.0/Fuse$
So what am I missing? Does anyone remember solving the same sort of problem? Can it be solved? Is it even considered a problem, more a feature?
Cheers.