On Thu, 2005-06-16 at 10:52 -0700, Zach Brown wrote:
+ if (likely(!atomic_read(&inode->inotify_watch_count)))
+ return;
Are there still platforms that implement atomic_read() with locks? I
wonder if there isn't a cheaper way for inodes to find out that they're
not involved in inotify.. maybe an inode function pointer that is only
set to queue_event when watchers are around?
I don't know what esoteric architectures are doing, but the solution
needs to be atomic (or we need to say "we don't care about races"--but
its hard not to care about a pointer race). On x86, at least, an
atomic_read() is trivial.
I actually would not mind being racey (in a safe way) or finding a
cheaper solution, especially if we could remove
inode->inotify_watch_count altogether (and not replace it with
anything).
But the overhead here is not biting us (we just went through some
off-list benchmarking that led to the inclusion of this check, in fact).