diff options
author | Eric Paris <eparis@redhat.com> | 2009-12-17 20:12:06 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:19 -0400 |
commit | b4277d3dd5a7400c1ea7fd4e7d64bda8899f84f5 (patch) | |
tree | 6b309bd5d5362292dded47af3ecf739c509892b1 | |
parent | 1a3aedbce416dfdbd5d5ac14a0edbcf21a62ee50 (diff) |
fsnotify: use fsnotify_create_event to allocate the q_overflow event
Currently fsnotify defines a static fsnotify event which is sent when a
group overflows its allotted queue length. This patch just allocates that
event from the event cache rather than defining it statically. There is no
known reason that the current implementation is wrong, but this makes sure the
event is initialized and created like any other.
Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r-- | fs/notify/notification.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/notify/notification.c b/fs/notify/notification.c index b8bf53b4c108..8481253d64b5 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c | |||
@@ -56,7 +56,7 @@ static struct kmem_cache *fsnotify_event_holder_cachep; | |||
56 | * it is needed. It's refcnt is set 1 at kernel init time and will never | 56 | * it is needed. It's refcnt is set 1 at kernel init time and will never |
57 | * get set to 0 so it will never get 'freed' | 57 | * get set to 0 so it will never get 'freed' |
58 | */ | 58 | */ |
59 | static struct fsnotify_event q_overflow_event; | 59 | static struct fsnotify_event *q_overflow_event; |
60 | static atomic_t fsnotify_sync_cookie = ATOMIC_INIT(0); | 60 | static atomic_t fsnotify_sync_cookie = ATOMIC_INIT(0); |
61 | 61 | ||
62 | /** | 62 | /** |
@@ -195,7 +195,7 @@ alloc_holder: | |||
195 | mutex_lock(&group->notification_mutex); | 195 | mutex_lock(&group->notification_mutex); |
196 | 196 | ||
197 | if (group->q_len >= group->max_events) { | 197 | if (group->q_len >= group->max_events) { |
198 | event = &q_overflow_event; | 198 | event = q_overflow_event; |
199 | ret = -EOVERFLOW; | 199 | ret = -EOVERFLOW; |
200 | /* sorry, no private data on the overflow event */ | 200 | /* sorry, no private data on the overflow event */ |
201 | priv = NULL; | 201 | priv = NULL; |
@@ -412,8 +412,11 @@ __init int fsnotify_notification_init(void) | |||
412 | fsnotify_event_cachep = KMEM_CACHE(fsnotify_event, SLAB_PANIC); | 412 | fsnotify_event_cachep = KMEM_CACHE(fsnotify_event, SLAB_PANIC); |
413 | fsnotify_event_holder_cachep = KMEM_CACHE(fsnotify_event_holder, SLAB_PANIC); | 413 | fsnotify_event_holder_cachep = KMEM_CACHE(fsnotify_event_holder, SLAB_PANIC); |
414 | 414 | ||
415 | initialize_event(&q_overflow_event); | 415 | q_overflow_event = fsnotify_create_event(NULL, FS_Q_OVERFLOW, NULL, |
416 | q_overflow_event.mask = FS_Q_OVERFLOW; | 416 | FSNOTIFY_EVENT_NONE, NULL, 0, |
417 | GFP_KERNEL); | ||
418 | if (!q_overflow_event) | ||
419 | panic("unable to allocate fsnotify q_overflow_event\n"); | ||
417 | 420 | ||
418 | return 0; | 421 | return 0; |
419 | } | 422 | } |