fsnotify: use kmem_cache_zalloc to simplify event initialization
authorEric Paris <eparis@redhat.com>
Fri, 18 Dec 2009 01:12:07 +0000 (20:12 -0500)
committerEric Paris <eparis@redhat.com>
Wed, 28 Jul 2010 13:58:20 +0000 (09:58 -0400)
fsnotify event initialization is done entry by entry with almost everything
set to either 0 or NULL.  Use kmem_cache_zalloc and only initialize things
that need non-zero initialization.  Also means we don't have to change
initialization entries based on the config options.

Signed-off-by: Eric Paris <eparis@redhat.com>
fs/notify/notification.c

index 8481253d64b54eef8bd81bde79ec8f5d05d4970c..b34ce7ad0409116643465566155dcefa60cb163c 100644 (file)
@@ -314,25 +314,14 @@ void fsnotify_flush_notify(struct fsnotify_group *group)
 
 static void initialize_event(struct fsnotify_event *event)
 {
-       event->holder.event = NULL;
        INIT_LIST_HEAD(&event->holder.event_list);
        atomic_set(&event->refcnt, 1);
 
        spin_lock_init(&event->lock);
 
-       event->path.dentry = NULL;
-       event->path.mnt = NULL;
-       event->inode = NULL;
        event->data_type = FSNOTIFY_EVENT_NONE;
 
        INIT_LIST_HEAD(&event->private_data_list);
-
-       event->to_tell = NULL;
-
-       event->file_name = NULL;
-       event->name_len = 0;
-
-       event->sync_cookie = 0;
 }
 
 /*
@@ -353,7 +342,7 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
 {
        struct fsnotify_event *event;
 
-       event = kmem_cache_alloc(fsnotify_event_cachep, gfp);
+       event = kmem_cache_zalloc(fsnotify_event_cachep, gfp);
        if (!event)
                return NULL;