aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-12-17 20:12:07 -0500
committerEric Paris <eparis@redhat.com>2010-07-28 09:58:20 -0400
commit6f3a539e3bd8ed2eafa532443723d56896153a00 (patch)
tree73c85129825daf947c32c2e1f6e9e97ed674b108
parentf0553af054d31f48a75fddd3ef8beb5c39715019 (diff)
fsnotify: use kmem_cache_zalloc to simplify event initialization
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>
-rw-r--r--fs/notify/notification.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index 8481253d64b5..b34ce7ad0409 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -314,25 +314,14 @@ void fsnotify_flush_notify(struct fsnotify_group *group)
314 314
315static void initialize_event(struct fsnotify_event *event) 315static void initialize_event(struct fsnotify_event *event)
316{ 316{
317 event->holder.event = NULL;
318 INIT_LIST_HEAD(&event->holder.event_list); 317 INIT_LIST_HEAD(&event->holder.event_list);
319 atomic_set(&event->refcnt, 1); 318 atomic_set(&event->refcnt, 1);
320 319
321 spin_lock_init(&event->lock); 320 spin_lock_init(&event->lock);
322 321
323 event->path.dentry = NULL;
324 event->path.mnt = NULL;
325 event->inode = NULL;
326 event->data_type = FSNOTIFY_EVENT_NONE; 322 event->data_type = FSNOTIFY_EVENT_NONE;
327 323
328 INIT_LIST_HEAD(&event->private_data_list); 324 INIT_LIST_HEAD(&event->private_data_list);
329
330 event->to_tell = NULL;
331
332 event->file_name = NULL;
333 event->name_len = 0;
334
335 event->sync_cookie = 0;
336} 325}
337 326
338/* 327/*
@@ -353,7 +342,7 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
353{ 342{
354 struct fsnotify_event *event; 343 struct fsnotify_event *event;
355 344
356 event = kmem_cache_alloc(fsnotify_event_cachep, gfp); 345 event = kmem_cache_zalloc(fsnotify_event_cachep, gfp);
357 if (!event) 346 if (!event)
358 return NULL; 347 return NULL;
359 348