This is uncalled for
Last week, I setup Planet Beagle to allow the world to see the 24/7 lives of the Beagle hackers, those cool cats, who apparently have knives. Garrett kicked up the stylish look in minutes and it was then and there that I realized the power of our awesome design team.
We are slowly transitioning more hackers -- some insanely clever, handsome, and charming hackers -- to Beagle and related hearty endeavors and I am excited, eager for the tasty foodstuffs we shall unleash on the hungry world.
Dinner with Thomas while he was in town. On his left, World's Best Manager.
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
- The file descriptor pins the directory, disallowing the backing device to be unmounted, which absolutely wrecks havoc with removable media.
- 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.
- dnotify uses signals to communicate with user-space.
- Specifically, dnotify uses SIGIO.
- 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.
- You open only a single fd, to the device node. No more pinning directories or opening a million file descriptors.
- 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.
- 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.
Beacon of Hope
I have been hacking on inotify, patches left and right, forward progress being made. Both patches and SUSE kernel RPM packages have been made available. I am working hard, fighting strong, but change like this in the kernel is hard.
Last night, JimmyK and Shaw of the Dead and I earned another first place trivia victory. Seriously now.
I also sold my Canon 10D to JimmyK, who will soon be traipsing around India and wherever else adventure is to be found. I hope he has fun, because I am going to miss him.