VFS event hooks in Linux

Robert Sandilands robert at vps.co.za
Tue Jun 29 14:06:55 GMT 1999


On Tue, 29 Jun 1999, Richard Gooch wrote:

> Jeremy Allison writes:
> > Richard Gooch wrote:
> > > 
> So if somewhere deep in a directory tree a change is made, the SMB
> client will rescan the *entire* tree?

If you look at the speed it happens at, it may be possible that Windoze
work that way :-)

> This may be possible too. Just tag a directory somewhere under / (it
> could even be /), and when an inode changes, walk up the directory
> entry tree looking for the tagged inode. You'd maintain a global count
> of tagged inodes, so that if it is 0, you can skip the walk.
> This would of course slow down inode writes on other filesystems or
> parts of the namespace as well.

If I understand correctly it would be very slow. The type of message
generated needs to be processed as quickly as possible. So having to walk
trees etc. is not the best idea when performance is an issue. 

> An alternative would be to make this per-FS. You can tag an inode
> anywhere in a FS, which also tags the superblock. You only walk up the
> tree if the FS is tagged. Unwatched filesystems would not suffer the
> walk penalty.

The idea of making it per-FS is a good idea.

I've written on-access scanners for Dos, Windows 3.x, Windows 9x, Windows
NT and Novell OS. I know that it is bad examples, but here goes my
experience :-) 

With Dos you caught the "interrupts" generated to handle the files and you
processed them... That is basically equivalent to taking over the library
functions for every posible file-API call - bad idea.

For the other you "connect" to a volume registering a call-back function
that got called for every possible file access on that volume. Some of
them you could specify a limited filter which defined for what types of
file access you wanted calls generated. Every call is accompanied with
enough information to directly identify the file/directory/direct disk
access taking place...

This implies you need to filter the calls you need yourself and act on
them.. Normally no API calls is needed to get any more information on the
file. On basically all these filesystems it is also a blocking call which
means you have to be quick or people complain a lot.

This approach is not very practical for Linux/Unix but it gives you an
idea of how other people do it.

_________________________________________________________________________
Silly little things like representing anybody else is not of importance
-------------------------------------------------------------------------
       Robert Sandilands - Peace is when the music of the soul
                 harmonizes with the music of Life
 Tel: +27-12-841-2106, Fax: +27-12-841-4670, Email: robert at vps.co.za
-------------------------------------------------------------------------



More information about the samba-technical mailing list