fake data io module for samba

Peter Somogyi PSOMOGYI at hu.ibm.com
Wed Oct 22 08:02:46 MDT 2014


> Code itself looks promising. However, you're catching
> vfswrap_pwrite (you should probably change that to
> vfs_fake_pwrite btw and also change vfswrap_pread
> to vfs_fake_pread) but not catching any of the other
> functions that can change the size.

Thank you for the look at, I will fix the function names.

> For example you need to catch ftruncate_fn and
> fallocate as well, plus to make it completely

Actually ftruncate is used already as a replacement of write (to keep 
metadata
consistent) and the most trivial case of sparse support (without hole) 
assumed.
With 0-sized files I'd have the fear of changing testcases themselves, 
though I
have no evidence. Now filesizes are accurate.

fallocate should also be IO-less with sparse support.

One may implement later any new features (vfs param switchable) in case of
further emerging needs.

Next interesting functions, for completeness:

pread_send, pread_write:
as mentioned in git comment, aio must be switched off.
To implement fakeio under aio properly, abstracting pread/pwrite calls
in aio (asys.c, vfs_aio*.c) would be the right way - in a separate patch
and separate discussion.

SMB_VFS_WRITE, SMB_VFS_READ: I don't see samba using them for real file IO
anywhere (except via PREAD / PWRITE ones that are intercepted) hence I'd 
skip these.

> generic you might need to ensure it's operating
> on a non-stream handle.

That's true, I should differentiate at least by error code.
(Actual vfs_default implementation also doesn't check the type before.)

> 
> Also, before I can 'Reviewed-by:' it, it needs to
> have documentation as well (sorry :-).

Added on my todo list now.

I plan to come up with the fix next week or so, but I'm glad to see 
opinions
meanwhile.

--
Peter Somogyi
IBM Magyarországi Kft.
1117 Budapest
Infopark, Neumann János u. 1.
Hungary
Phone: +36 1 382 5469


More information about the samba-technical mailing list