Also, inotify is suboptimal for this use case. inotify has no recursion support, which means that the user must keep a watch on all files individually. There is also a limit to the number of inotify watches that can be in place at any one time.
A more modern, and more suitable interface for this use case is fanotify. It doesn't provide all the functions that inotify does, but importantly it supports recursion, which alone would seem to make it a more obvious choice for this task.
Any more information on this? I'm curious to read why.