mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
fsnotify: Move locking into fsnotify_find_mark()
Move locking of a mark list into fsnotify_find_mark(). This reduces code churn in the following patch changing lock protecting the list. Reviewed-by: Miklos Szeredi <[email protected]> Reviewed-by: Amir Goldstein <[email protected]> Signed-off-by: Jan Kara <[email protected]>
This commit is contained in:
parent
a242677bb1
commit
f06fd98759
3 changed files with 10 additions and 13 deletions
|
|
@ -71,13 +71,7 @@ void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group)
|
|||
struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group,
|
||||
struct inode *inode)
|
||||
{
|
||||
struct fsnotify_mark *mark;
|
||||
|
||||
spin_lock(&inode->i_lock);
|
||||
mark = fsnotify_find_mark(inode->i_fsnotify_marks, group);
|
||||
spin_unlock(&inode->i_lock);
|
||||
|
||||
return mark;
|
||||
return fsnotify_find_mark(inode->i_fsnotify_marks, group);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -485,16 +485,24 @@ struct fsnotify_mark *fsnotify_find_mark(struct fsnotify_mark_connector *conn,
|
|||
struct fsnotify_group *group)
|
||||
{
|
||||
struct fsnotify_mark *mark;
|
||||
spinlock_t *lock;
|
||||
|
||||
if (!conn)
|
||||
return NULL;
|
||||
|
||||
if (conn->flags & FSNOTIFY_OBJ_TYPE_INODE)
|
||||
lock = &conn->inode->i_lock;
|
||||
else
|
||||
lock = &conn->mnt->mnt_root->d_lock;
|
||||
spin_lock(lock);
|
||||
hlist_for_each_entry(mark, &conn->list, obj_list) {
|
||||
if (mark->group == group) {
|
||||
fsnotify_get_mark(mark);
|
||||
spin_unlock(lock);
|
||||
return mark;
|
||||
}
|
||||
}
|
||||
spin_unlock(lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,11 +65,6 @@ struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group,
|
|||
struct vfsmount *mnt)
|
||||
{
|
||||
struct mount *m = real_mount(mnt);
|
||||
struct fsnotify_mark *mark;
|
||||
|
||||
spin_lock(&mnt->mnt_root->d_lock);
|
||||
mark = fsnotify_find_mark(m->mnt_fsnotify_marks, group);
|
||||
spin_unlock(&mnt->mnt_root->d_lock);
|
||||
|
||||
return mark;
|
||||
return fsnotify_find_mark(m->mnt_fsnotify_marks, group);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue