lkml.org 
[lkml]   [2010]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 3/6] dnotify: replace dnotify_mark_mutex with dnotify_group mutex

Since we introduced a new mutex for fsnotify groups we dont need an extra
dnotify_mark_mutex any more.
This patch replaces the dnotify_mark_mutex with the dnotify_group mutex.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
---
fs/notify/dnotify/dnotify.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index 3344bdd..89ec7e0 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -31,7 +31,6 @@ int dir_notify_enable __read_mostly = 1;
static struct kmem_cache *dnotify_struct_cache __read_mostly;
static struct kmem_cache *dnotify_mark_cache __read_mostly;
static struct fsnotify_group *dnotify_group __read_mostly;
-static DEFINE_MUTEX(dnotify_mark_mutex);

/*
* dnotify will attach one of these to each inode (i_fsnotify_marks) which
@@ -183,7 +182,7 @@ void dnotify_flush(struct file *filp, fl_owner_t id)
return;
dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);

- mutex_lock(&dnotify_mark_mutex);
+ mutex_lock(&dnotify_group->mutex);

spin_lock(&fsn_mark->lock);
prev = &dn_mark->dn;
@@ -199,11 +198,11 @@ void dnotify_flush(struct file *filp, fl_owner_t id)

spin_unlock(&fsn_mark->lock);

- /* nothing else could have found us thanks to the dnotify_mark_mutex */
+ /* nothing else could have found us thanks to the dnotify_group mutex */
if (dn_mark->dn == NULL)
fsnotify_destroy_mark(fsn_mark);

- mutex_unlock(&dnotify_mark_mutex);
+ mutex_unlock(&dnotify_group->mutex);

fsnotify_put_mark(fsn_mark);
}
@@ -326,7 +325,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
new_dn_mark->dn = NULL;

/* this is needed to prevent the fcntl/close race described below */
- mutex_lock(&dnotify_mark_mutex);
+ mutex_lock(&dnotify_group->mutex);

/* add the new_fsn_mark or find an old one. */
fsn_mark = fsnotify_find_inode_mark(dnotify_group, inode);
@@ -348,8 +347,8 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)

/* if (f != filp) means that we lost a race and another task/thread
* actually closed the fd we are still playing with before we grabbed
- * the dnotify_mark_mutex and fsn_mark->lock. Since closing the fd is the
- * only time we clean up the marks we need to get our mark off
+ * the dnotify_group mutex and fsn_mark->lock. Since closing the fd is
+ * the only time we clean up the marks we need to get our mark off
* the list. */
if (f != filp) {
/* if we added ourselves, shoot ourselves, it's possible that
@@ -387,7 +386,7 @@ out:
if (destroy)
fsnotify_destroy_mark(fsn_mark);

- mutex_unlock(&dnotify_mark_mutex);
+ mutex_unlock(&dnotify_group->mutex);
fsnotify_put_mark(fsn_mark);
out_err:
if (new_fsn_mark)
--
1.5.6.5


\
 
 \ /
  Last update: 2010-12-02 11:09    [W:1.672 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site