diff options
author | Robert Love <rml@novell.com> | 2005-07-12 17:06:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-12 23:38:38 -0400 |
commit | 0eeca28300df110bd6ed54b31193c83b87921443 (patch) | |
tree | 7db42d8a18d80eca538f5b7d25e0532b8fa38b85 /fs/inode.c | |
parent | bd4c625c061c2a38568d0add3478f59172455159 (diff) |
[PATCH] inotify
inotify is intended to correct the deficiencies of dnotify, particularly
its inability to scale and its terrible user interface:
* dnotify requires the opening of one fd per each directory
that you intend to watch. This quickly results in too many
open files and pins removable media, preventing unmount.
* 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.
* dnotify's interface to user-space is awful. Signals?
inotify provides a more usable, simple, powerful solution to file change
notification:
* inotify's interface is a system call that returns a fd, not SIGIO.
You get a single fd, which is select()-able.
* inotify has an event that says "the filesystem that the item
you were watching is on was unmounted."
* inotify can watch directories or files.
Inotify is currently used by Beagle (a desktop search infrastructure),
Gamin (a FAM replacement), and other projects.
See Documentation/filesystems/inotify.txt.
Signed-off-by: Robert Love <rml@novell.com>
Cc: John McCutchan <ttb@tentacle.dhs.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/inode.c b/fs/inode.c index 5bc97507eeaa..96364fae0844 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/pagemap.h> | 21 | #include <linux/pagemap.h> |
22 | #include <linux/cdev.h> | 22 | #include <linux/cdev.h> |
23 | #include <linux/bootmem.h> | 23 | #include <linux/bootmem.h> |
24 | #include <linux/inotify.h> | ||
24 | 25 | ||
25 | /* | 26 | /* |
26 | * This is needed for the following functions: | 27 | * This is needed for the following functions: |
@@ -202,6 +203,10 @@ void inode_init_once(struct inode *inode) | |||
202 | INIT_LIST_HEAD(&inode->i_data.i_mmap_nonlinear); | 203 | INIT_LIST_HEAD(&inode->i_data.i_mmap_nonlinear); |
203 | spin_lock_init(&inode->i_lock); | 204 | spin_lock_init(&inode->i_lock); |
204 | i_size_ordered_init(inode); | 205 | i_size_ordered_init(inode); |
206 | #ifdef CONFIG_INOTIFY | ||
207 | INIT_LIST_HEAD(&inode->inotify_watches); | ||
208 | sema_init(&inode->inotify_sem, 1); | ||
209 | #endif | ||
205 | } | 210 | } |
206 | 211 | ||
207 | EXPORT_SYMBOL(inode_init_once); | 212 | EXPORT_SYMBOL(inode_init_once); |
@@ -351,6 +356,7 @@ int invalidate_inodes(struct super_block * sb) | |||
351 | 356 | ||
352 | down(&iprune_sem); | 357 | down(&iprune_sem); |
353 | spin_lock(&inode_lock); | 358 | spin_lock(&inode_lock); |
359 | inotify_unmount_inodes(&sb->s_inodes); | ||
354 | busy = invalidate_list(&sb->s_inodes, &throw_away); | 360 | busy = invalidate_list(&sb->s_inodes, &throw_away); |
355 | spin_unlock(&inode_lock); | 361 | spin_unlock(&inode_lock); |
356 | 362 | ||