lkml.org 
[lkml]   [2009]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 5/5] fsnotify: use kmem_cache_zalloc to simplify event initialization
Date
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 | 13 +------------
1 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index 4ab9243..96ffbd0 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -311,25 +311,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;
}

/*
@@ -350,7 +339,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;



\
 
 \ /
  Last update: 2009-08-10 00:03    [W:0.057 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site