[gamin] Re: [RFC][PATCH] inotify 0.9.2



On Sun, 2004-09-19 at 23:56 -0400, John McCutchan wrote:

> I would appreciate design review, code review and testing.

Hi, John.

When you pass SLAB_PANIC to kmem_cache_create(), the slab layer will
panic the kernel and thus halt the machine.  So there is no reason to
check the return value.

We could remove the SLAB_PANIC, but I think that it makes sense, so
instead I removed the code checking the returns, saving a few bytes.

Patch is against your inotify patch.

	Robert Love

Signed-Off-By: Robert Love <rml novell com>

 drivers/char/inotify.c |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diff -urN linux-inotify/drivers/char/inotify.c linux/drivers/char/inotify.c
--- linux-inotify/drivers/char/inotify.c	2004-09-20 17:10:58.000000000 -0400
+++ linux/drivers/char/inotify.c	2004-09-20 17:33:03.369317992 -0400
@@ -942,19 +942,13 @@
 
 	inotify_debug_flags = INOTIFY_DEBUG_NONE;
 
-	watcher_cache = kmem_cache_create ("watcher_cache", 
-			sizeof(struct inotify_watcher), 0, SLAB_PANIC, NULL, NULL);
-
-	if (!watcher_cache) {
-		misc_deregister (&inotify_device);
-	}
-	kevent_cache = kmem_cache_create ("kevent_cache", 
-			sizeof(struct inotify_kernel_event), 0, SLAB_PANIC, NULL, NULL);
-
-	if (!kevent_cache) {
-		misc_deregister (&inotify_device);
-		kmem_cache_destroy (watcher_cache);
-	}
+	watcher_cache = kmem_cache_create ("watcher_cache",
+			sizeof(struct inotify_watcher), 0,
+			SLAB_PANIC, NULL, NULL);
+
+	kevent_cache = kmem_cache_create ("kevent_cache",
+			sizeof(struct inotify_kernel_event), 0,
+			SLAB_PANIC, NULL, NULL);
 
 	printk(KERN_ALERT "inotify 0.9.2 minor=%d\n", inotify_device.minor);
 out:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]