mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
Rename struct file->f_ep_lock
This lock moves out of the CONFIG_EPOLL ifdef and becomes f_lock. For now, epoll remains the only user, but a future patch will use it to protect f_flags as well. Cc: Davide Libenzi <davidel@xmailserver.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
parent
041b62374c
commit
6849991490
4 changed files with 9 additions and 7 deletions
|
@ -417,10 +417,10 @@ static int ep_remove(struct eventpoll *ep, struct epitem *epi)
|
||||||
ep_unregister_pollwait(ep, epi);
|
ep_unregister_pollwait(ep, epi);
|
||||||
|
|
||||||
/* Remove the current item from the list of epoll hooks */
|
/* Remove the current item from the list of epoll hooks */
|
||||||
spin_lock(&file->f_ep_lock);
|
spin_lock(&file->f_lock);
|
||||||
if (ep_is_linked(&epi->fllink))
|
if (ep_is_linked(&epi->fllink))
|
||||||
list_del_init(&epi->fllink);
|
list_del_init(&epi->fllink);
|
||||||
spin_unlock(&file->f_ep_lock);
|
spin_unlock(&file->f_lock);
|
||||||
|
|
||||||
rb_erase(&epi->rbn, &ep->rbr);
|
rb_erase(&epi->rbn, &ep->rbr);
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ void eventpoll_release_file(struct file *file)
|
||||||
struct epitem *epi;
|
struct epitem *epi;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't want to get "file->f_ep_lock" because it is not
|
* We don't want to get "file->f_lock" because it is not
|
||||||
* necessary. It is not necessary because we're in the "struct file"
|
* necessary. It is not necessary because we're in the "struct file"
|
||||||
* cleanup path, and this means that noone is using this file anymore.
|
* cleanup path, and this means that noone is using this file anymore.
|
||||||
* So, for example, epoll_ctl() cannot hit here sicne if we reach this
|
* So, for example, epoll_ctl() cannot hit here sicne if we reach this
|
||||||
|
@ -547,6 +547,8 @@ void eventpoll_release_file(struct file *file)
|
||||||
* will correctly serialize the operation. We do need to acquire
|
* will correctly serialize the operation. We do need to acquire
|
||||||
* "ep->mtx" after "epmutex" because ep_remove() requires it when called
|
* "ep->mtx" after "epmutex" because ep_remove() requires it when called
|
||||||
* from anywhere but ep_free().
|
* from anywhere but ep_free().
|
||||||
|
*
|
||||||
|
* Besides, ep_remove() acquires the lock, so we can't hold it here.
|
||||||
*/
|
*/
|
||||||
mutex_lock(&epmutex);
|
mutex_lock(&epmutex);
|
||||||
|
|
||||||
|
@ -785,9 +787,9 @@ static int ep_insert(struct eventpoll *ep, struct epoll_event *event,
|
||||||
goto error_unregister;
|
goto error_unregister;
|
||||||
|
|
||||||
/* Add the current item to the list of active epoll hook for this file */
|
/* Add the current item to the list of active epoll hook for this file */
|
||||||
spin_lock(&tfile->f_ep_lock);
|
spin_lock(&tfile->f_lock);
|
||||||
list_add_tail(&epi->fllink, &tfile->f_ep_links);
|
list_add_tail(&epi->fllink, &tfile->f_ep_links);
|
||||||
spin_unlock(&tfile->f_ep_lock);
|
spin_unlock(&tfile->f_lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add the current item to the RB tree. All RB tree operations are
|
* Add the current item to the RB tree. All RB tree operations are
|
||||||
|
|
|
@ -127,6 +127,7 @@ struct file *get_empty_filp(void)
|
||||||
atomic_long_set(&f->f_count, 1);
|
atomic_long_set(&f->f_count, 1);
|
||||||
rwlock_init(&f->f_owner.lock);
|
rwlock_init(&f->f_owner.lock);
|
||||||
f->f_cred = get_cred(cred);
|
f->f_cred = get_cred(cred);
|
||||||
|
spin_lock_init(&f->f_lock);
|
||||||
eventpoll_init_file(f);
|
eventpoll_init_file(f);
|
||||||
/* f->f_version: 0 */
|
/* f->f_version: 0 */
|
||||||
return f;
|
return f;
|
||||||
|
|
|
@ -61,7 +61,6 @@ struct file;
|
||||||
static inline void eventpoll_init_file(struct file *file)
|
static inline void eventpoll_init_file(struct file *file)
|
||||||
{
|
{
|
||||||
INIT_LIST_HEAD(&file->f_ep_links);
|
INIT_LIST_HEAD(&file->f_ep_links);
|
||||||
spin_lock_init(&file->f_ep_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -848,6 +848,7 @@ struct file {
|
||||||
#define f_dentry f_path.dentry
|
#define f_dentry f_path.dentry
|
||||||
#define f_vfsmnt f_path.mnt
|
#define f_vfsmnt f_path.mnt
|
||||||
const struct file_operations *f_op;
|
const struct file_operations *f_op;
|
||||||
|
spinlock_t f_lock; /* f_ep_links */
|
||||||
atomic_long_t f_count;
|
atomic_long_t f_count;
|
||||||
unsigned int f_flags;
|
unsigned int f_flags;
|
||||||
fmode_t f_mode;
|
fmode_t f_mode;
|
||||||
|
@ -866,7 +867,6 @@ struct file {
|
||||||
#ifdef CONFIG_EPOLL
|
#ifdef CONFIG_EPOLL
|
||||||
/* Used by fs/eventpoll.c to link all the hooks to this file */
|
/* Used by fs/eventpoll.c to link all the hooks to this file */
|
||||||
struct list_head f_ep_links;
|
struct list_head f_ep_links;
|
||||||
spinlock_t f_ep_lock;
|
|
||||||
#endif /* #ifdef CONFIG_EPOLL */
|
#endif /* #ifdef CONFIG_EPOLL */
|
||||||
struct address_space *f_mapping;
|
struct address_space *f_mapping;
|
||||||
#ifdef CONFIG_DEBUG_WRITECOUNT
|
#ifdef CONFIG_DEBUG_WRITECOUNT
|
||||||
|
|
Loading…
Reference in a new issue