mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-24 13:13:57 +08:00
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>
This commit is contained in:
parent
1a3aedbce4
commit
b4277d3dd5
@ -56,7 +56,7 @@ static struct kmem_cache *fsnotify_event_holder_cachep;
|
|||||||
* it is needed. It's refcnt is set 1 at kernel init time and will never
|
* it is needed. It's refcnt is set 1 at kernel init time and will never
|
||||||
* get set to 0 so it will never get 'freed'
|
* get set to 0 so it will never get 'freed'
|
||||||
*/
|
*/
|
||||||
static struct fsnotify_event q_overflow_event;
|
static struct fsnotify_event *q_overflow_event;
|
||||||
static atomic_t fsnotify_sync_cookie = ATOMIC_INIT(0);
|
static atomic_t fsnotify_sync_cookie = ATOMIC_INIT(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -195,7 +195,7 @@ alloc_holder:
|
|||||||
mutex_lock(&group->notification_mutex);
|
mutex_lock(&group->notification_mutex);
|
||||||
|
|
||||||
if (group->q_len >= group->max_events) {
|
if (group->q_len >= group->max_events) {
|
||||||
event = &q_overflow_event;
|
event = q_overflow_event;
|
||||||
ret = -EOVERFLOW;
|
ret = -EOVERFLOW;
|
||||||
/* sorry, no private data on the overflow event */
|
/* sorry, no private data on the overflow event */
|
||||||
priv = NULL;
|
priv = NULL;
|
||||||
@ -412,8 +412,11 @@ __init int fsnotify_notification_init(void)
|
|||||||
fsnotify_event_cachep = KMEM_CACHE(fsnotify_event, SLAB_PANIC);
|
fsnotify_event_cachep = KMEM_CACHE(fsnotify_event, SLAB_PANIC);
|
||||||
fsnotify_event_holder_cachep = KMEM_CACHE(fsnotify_event_holder, SLAB_PANIC);
|
fsnotify_event_holder_cachep = KMEM_CACHE(fsnotify_event_holder, SLAB_PANIC);
|
||||||
|
|
||||||
initialize_event(&q_overflow_event);
|
q_overflow_event = fsnotify_create_event(NULL, FS_Q_OVERFLOW, NULL,
|
||||||
q_overflow_event.mask = FS_Q_OVERFLOW;
|
FSNOTIFY_EVENT_NONE, NULL, 0,
|
||||||
|
GFP_KERNEL);
|
||||||
|
if (!q_overflow_event)
|
||||||
|
panic("unable to allocate fsnotify q_overflow_event\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user