HOWTO write VFS
Marek Grac
xgrac at fi.muni.cz
Mon Feb 14 20:55:04 GMT 2005
Hi,
As I have just finished my work with Samba, I would like to leave some
information for others followers. My VFS is not using any filesystem
underneath, so every byte is stored in data. Files are stored in BLOB and
metadata are stored as attributes in Firebird database. There is
multi-level directory hierarchy and you can mount just part of the
filesystem (like in Novell; admin can see everything but you can limit
users).
So you have to have samba, gcc & similar stuff that you have already. When
testing your VFS it is important to know that when using smbclient you
don't have to restart Samba and you always have latest version, but when
testing with Windows it is much more safer to always restart Samba to be
sure that Win use latest version and don't have any connection which use
older version.
When you are writing your VFS, you have to put #include "includes.h" from
Samba as first include elsewhere you will have problem with size of file
because several structures have different length (e.g. dirent). Then it is
much more safer to start with just directories, so you can browse through
them.
Suggested phases: directories read-only, directories read-write (mkdir,
rmdir), show files with correct metadata, be able to read from file and
read-write fs.
I will not write about details but some ideas:
- you have to say Windows that your fs is rw even if is ro (you will pass
through some problems)
- you have to cache metadata because dir on large directory (in my case
~5000 files) will be too slow ~1 minutes (with cache it is 2-3 seconds).
- you have to implement non sequential access for reading (for using with
resident antivirus, MS Office, ...) even if it will be slow
- you have to implement non-sequential access for writing if you want to
write from Office applications directly (simple applications, will work
without it; and you can always copy file)
- if you want to write real filesystem you can have problem with last item
in list because BLOB can't be (usually) written as you will need. It can
be written but you have to have part of files in memory (what can be
problem when serving a lot of open files)
- When using firebird (P4 2GHz, 2GB, IDE disk) you can expect avg speed
about 300kB/s. When database is on tuned firebird with raid you can
expect 3MiB/second.
My project was non-free but I can help with constultation on free projects
(just contact me). Now my intermezzo with Samba is finished :) I will be
happy if someone will find this mail usefull. Any question?
pax, marx
--
[****************************][*************************************]
[ marek 'marx' grác / gerard ][ Električke, ktorej zmizli koľajnice ]
[ xgrac at fi.muni.cz ][ nezostáva nič iné ako lietať ]
[****************************][*************************************]
More information about the samba-technical
mailing list