2.6 Kernel with inotify patch
Nick Hudson
nhudson at lunar-linux.org
Tue Oct 26 15:51:10 UTC 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have made a linux-2.6 kernel with the inotify patch just for my
testing atm, but if anyone wants it you can get it at
http://nhudson.homelinux.org/files/linux-2.6.tar.bz2 . My server is
down atm but it will be back up later around 12:00 cst. if anyone
wants to try it. In case you are wondering what inotify is here ya go:
Why Not dnotify and Why inotify
Everyone seems quick to deride the blunder known as "dnotify" and
applaud a
replacement, any replacement, man anything but that current mess, but
in the
name of fairness I present my treatise on why dnotify is what one
might call
not good:
* dnotify requires the opening of one fd per each directory that you
intend to
~ watch.
~ o The file descriptor pins the directory, disallowing the backing
~ device to be unmounted, which absolutely wrecks havoc with
removable
~ media.
~ o Watching many directories results in many open file descriptors,
~ possibly hitting a per-process fd limit.
* dnotify is directory-based. You only learn about changes to directories.
~ Sure, a change to a file in a directory affects the directory, but
you are
~ then forced to keep a cache of stat structures around to compare
things in
~ order to find out which file.
* dnotify's interface to user-space is awful.
~ o dnotify uses signals to communicate with user-space.
~ o Specifically, dnotify uses SIGIO.
~ o But then you can pick a different signal! So by "signals," I really
~ meant you need to use real-time signals if you want to queue the
~ events.
* dnotify basically ignores any problems that would arise in the VFS
from hard
~ links.
* Rumor is that the "d" in "dnotify" does not stand for "directory"
but for
~ "suck."
A suitable replacement is "inotify." And now, my tract on what inotify
brings
to the table:
* inotify's interface is a device node, not SIGIO.
~ o You open only a single fd, to the device node. No more pinning
~ directories or opening a million file descriptors.
~ o Usage is nice: open the device, issue simple commands via ioctl(),
~ and then block on the device. It returns events when, well,
there are
~ events to be returned.
~ o You can select() on the device node and so it integrates with main
~ loops like coffee mixed with vanilla milkshake.
* inotify has an event that says "the filesystem that the item you were
~ watching is on was unmounted" (this is particularly cool).
* inotify can watch directories or files.
* The "i" in inotify does not stand for "suck" but for "inode" -- the
logical
~ choice since inotify is inode-based.
I will have a inotify-utils module ready by tonight I hope.
Nick
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
iD8DBQFBfnJtG5D1jWCZpTwRAuBSAJ0almJdCtNNgvy48cHW3KAspONSbgCgxvBz
6HUk0lF6y/ovjTmOLrEDYoI=
=I8ln
-----END PGP SIGNATURE-----
More information about the Lunar
mailing list