From: Anton Blanchard <anton@samba.org>

Directory notify code was showing up in a dd bs=1024k from 2 raid arrays
on an emulex FC adapter:

3635     69.4896  vmlinux-2.6.5            .default_idle
332       6.3468  vmlinux-2.6.5            .__copy_tofrom_user
112       2.1411  vmlinux-2.6.5            .save_remaining_regs
76        1.4529  vmlinux-2.6.5            .scsi_dispatch_cmd
64        1.2235  vmlinux-2.6.5            .dnotify_parent
61        1.1661  vmlinux-2.6.5            .do_generic_mapping_read

We already have a sysctl to enable/disable it, the patch below uses it
in dnotify_parent. dnotify_parent disappears and idle time goes up:

4508     70.8582  vmlinux-2.6.5            .default_idle
253       3.9767  vmlinux-2.6.5            .__copy_tofrom_user
142       2.2320  vmlinux-2.6.5            .save_remaining_regs
88        1.3832  vmlinux-2.6.5            .shrink_zone
84        1.3203  vmlinux-2.6.5            .elx_drvr_unlock
75        1.1789  vmlinux-2.6.5            .scsi_dispatch_cmd
69        1.0846  vmlinux-2.6.5            .do_generic_mapping_read

Of course, to gain this small speedup isers need to know to set
/proc/sys/fs/dir-notify-enable to zero.  Nobody does that.


---

 25-akpm/fs/dnotify.c |    3 +++
 1 files changed, 3 insertions(+)

diff -puN fs/dnotify.c~dnotify_parent-speedup fs/dnotify.c
--- 25/fs/dnotify.c~dnotify_parent-speedup	2004-04-09 18:30:07.434716160 -0700
+++ 25-akpm/fs/dnotify.c	2004-04-09 18:30:07.443714792 -0700
@@ -154,6 +154,9 @@ void dnotify_parent(struct dentry *dentr
 {
 	struct dentry *parent;
 
+	if (!dir_notify_enable)
+		return;
+
 	spin_lock(&dentry->d_lock);
 	parent = dentry->d_parent;
 	if (parent->d_inode->i_dnotify_mask & event) {

_