Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
c63181e6
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c63181e6
编写于
11月 25, 2011
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vfs: move fsnotify junk to struct mount
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
52ba1621
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
42 deletion
+47
-42
fs/mount.h
fs/mount.h
+4
-1
fs/namespace.c
fs/namespace.c
+22
-23
fs/notify/fanotify/fanotify_user.c
fs/notify/fanotify/fanotify_user.c
+4
-2
fs/notify/fsnotify.c
fs/notify/fsnotify.c
+5
-4
fs/notify/vfsmount_mark.c
fs/notify/vfsmount_mark.c
+12
-7
include/linux/mount.h
include/linux/mount.h
+0
-5
未找到文件。
fs/mount.h
浏览文件 @
c63181e6
...
...
@@ -19,7 +19,6 @@ struct mount {
#endif
struct
list_head
mnt_mounts
;
/* list of children, anchored here */
struct
list_head
mnt_child
;
/* and going through their mnt_child */
/* yet to be moved - fsnotify ones go here */
const
char
*
mnt_devname
;
/* Name of device e.g. /dev/dsk/hda1 */
struct
list_head
mnt_list
;
struct
list_head
mnt_expire
;
/* link in fs-specific expiry list */
...
...
@@ -28,6 +27,10 @@ struct mount {
struct
list_head
mnt_slave
;
/* slave list entry */
struct
mount
*
mnt_master
;
/* slave is on master->mnt_slave_list */
struct
mnt_namespace
*
mnt_ns
;
/* containing namespace */
#ifdef CONFIG_FSNOTIFY
struct
hlist_head
mnt_fsnotify_marks
;
__u32
mnt_fsnotify_mask
;
#endif
int
mnt_id
;
/* mount identifier */
int
mnt_group_id
;
/* peer group identifier */
int
mnt_expiry_mark
;
/* true if marked for expiry */
...
...
fs/namespace.c
浏览文件 @
c63181e6
...
...
@@ -173,54 +173,53 @@ unsigned int mnt_get_count(struct mount *mnt)
static
struct
mount
*
alloc_vfsmnt
(
const
char
*
name
)
{
struct
mount
*
p
=
kmem_cache_zalloc
(
mnt_cache
,
GFP_KERNEL
);
if
(
p
)
{
struct
vfsmount
*
mnt
=
&
p
->
mnt
;
struct
mount
*
mnt
=
kmem_cache_zalloc
(
mnt_cache
,
GFP_KERNEL
);
if
(
mnt
)
{
int
err
;
err
=
mnt_alloc_id
(
p
);
err
=
mnt_alloc_id
(
mnt
);
if
(
err
)
goto
out_free_cache
;
if
(
name
)
{
p
->
mnt_devname
=
kstrdup
(
name
,
GFP_KERNEL
);
if
(
!
p
->
mnt_devname
)
mnt
->
mnt_devname
=
kstrdup
(
name
,
GFP_KERNEL
);
if
(
!
mnt
->
mnt_devname
)
goto
out_free_id
;
}
#ifdef CONFIG_SMP
p
->
mnt_pcp
=
alloc_percpu
(
struct
mnt_pcp
);
if
(
!
p
->
mnt_pcp
)
mnt
->
mnt_pcp
=
alloc_percpu
(
struct
mnt_pcp
);
if
(
!
mnt
->
mnt_pcp
)
goto
out_free_devname
;
this_cpu_add
(
p
->
mnt_pcp
->
mnt_count
,
1
);
this_cpu_add
(
mnt
->
mnt_pcp
->
mnt_count
,
1
);
#else
p
->
mnt_count
=
1
;
p
->
mnt_writers
=
0
;
mnt
->
mnt_count
=
1
;
mnt
->
mnt_writers
=
0
;
#endif
INIT_LIST_HEAD
(
&
p
->
mnt_hash
);
INIT_LIST_HEAD
(
&
p
->
mnt_child
);
INIT_LIST_HEAD
(
&
p
->
mnt_mounts
);
INIT_LIST_HEAD
(
&
p
->
mnt_list
);
INIT_LIST_HEAD
(
&
p
->
mnt_expire
);
INIT_LIST_HEAD
(
&
p
->
mnt_share
);
INIT_LIST_HEAD
(
&
p
->
mnt_slave_list
);
INIT_LIST_HEAD
(
&
p
->
mnt_slave
);
INIT_LIST_HEAD
(
&
mnt
->
mnt_hash
);
INIT_LIST_HEAD
(
&
mnt
->
mnt_child
);
INIT_LIST_HEAD
(
&
mnt
->
mnt_mounts
);
INIT_LIST_HEAD
(
&
mnt
->
mnt_list
);
INIT_LIST_HEAD
(
&
mnt
->
mnt_expire
);
INIT_LIST_HEAD
(
&
mnt
->
mnt_share
);
INIT_LIST_HEAD
(
&
mnt
->
mnt_slave_list
);
INIT_LIST_HEAD
(
&
mnt
->
mnt_slave
);
#ifdef CONFIG_FSNOTIFY
INIT_HLIST_HEAD
(
&
mnt
->
mnt_fsnotify_marks
);
#endif
}
return
p
;
return
mnt
;
#ifdef CONFIG_SMP
out_free_devname:
kfree
(
p
->
mnt_devname
);
kfree
(
mnt
->
mnt_devname
);
#endif
out_free_id:
mnt_free_id
(
p
);
mnt_free_id
(
mnt
);
out_free_cache:
kmem_cache_free
(
mnt_cache
,
p
);
kmem_cache_free
(
mnt_cache
,
mnt
);
return
NULL
;
}
...
...
fs/notify/fanotify/fanotify_user.c
浏览文件 @
c63181e6
...
...
@@ -16,6 +16,8 @@
#include <asm/ioctls.h>
#include "../../mount.h"
#define FANOTIFY_DEFAULT_MAX_EVENTS 16384
#define FANOTIFY_DEFAULT_MAX_MARKS 8192
#define FANOTIFY_DEFAULT_MAX_LISTENERS 128
...
...
@@ -546,7 +548,7 @@ static int fanotify_remove_vfsmount_mark(struct fsnotify_group *group,
removed
=
fanotify_mark_remove_from_mask
(
fsn_mark
,
mask
,
flags
);
fsnotify_put_mark
(
fsn_mark
);
if
(
removed
&
mnt
->
mnt_fsnotify_mask
)
if
(
removed
&
real_mount
(
mnt
)
->
mnt_fsnotify_mask
)
fsnotify_recalc_vfsmount_mask
(
mnt
);
return
0
;
...
...
@@ -623,7 +625,7 @@ static int fanotify_add_vfsmount_mark(struct fsnotify_group *group,
}
added
=
fanotify_mark_add_to_mask
(
fsn_mark
,
mask
,
flags
);
if
(
added
&
~
mnt
->
mnt_fsnotify_mask
)
if
(
added
&
~
real_mount
(
mnt
)
->
mnt_fsnotify_mask
)
fsnotify_recalc_vfsmount_mask
(
mnt
);
err:
fsnotify_put_mark
(
fsn_mark
);
...
...
fs/notify/fsnotify.c
浏览文件 @
c63181e6
...
...
@@ -26,6 +26,7 @@
#include <linux/fsnotify_backend.h>
#include "fsnotify.h"
#include "../mount.h"
/*
* Clear all of the marks on an inode when it is being evicted from core
...
...
@@ -205,13 +206,13 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
struct
fsnotify_mark
*
inode_mark
=
NULL
,
*
vfsmount_mark
=
NULL
;
struct
fsnotify_group
*
inode_group
,
*
vfsmount_group
;
struct
fsnotify_event
*
event
=
NULL
;
struct
vfs
mount
*
mnt
;
struct
mount
*
mnt
;
int
idx
,
ret
=
0
;
/* global tests shouldn't care about events on child only the specific event */
__u32
test_mask
=
(
mask
&
~
FS_EVENT_ON_CHILD
);
if
(
data_is
==
FSNOTIFY_EVENT_PATH
)
mnt
=
((
struct
path
*
)
data
)
->
mnt
;
mnt
=
real_mount
(((
struct
path
*
)
data
)
->
mnt
)
;
else
mnt
=
NULL
;
...
...
@@ -262,11 +263,11 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
/* we didn't use the vfsmount_mark */
vfsmount_group
=
NULL
;
}
else
if
(
vfsmount_group
>
inode_group
)
{
ret
=
send_to_group
(
to_tell
,
mnt
,
NULL
,
vfsmount_mark
,
mask
,
data
,
ret
=
send_to_group
(
to_tell
,
&
mnt
->
mnt
,
NULL
,
vfsmount_mark
,
mask
,
data
,
data_is
,
cookie
,
file_name
,
&
event
);
inode_group
=
NULL
;
}
else
{
ret
=
send_to_group
(
to_tell
,
mnt
,
inode_mark
,
vfsmount_mark
,
ret
=
send_to_group
(
to_tell
,
&
mnt
->
mnt
,
inode_mark
,
vfsmount_mark
,
mask
,
data
,
data_is
,
cookie
,
file_name
,
&
event
);
}
...
...
fs/notify/vfsmount_mark.c
浏览文件 @
c63181e6
...
...
@@ -28,15 +28,17 @@
#include <linux/fsnotify_backend.h>
#include "fsnotify.h"
#include "../mount.h"
void
fsnotify_clear_marks_by_mount
(
struct
vfsmount
*
mnt
)
{
struct
fsnotify_mark
*
mark
,
*
lmark
;
struct
hlist_node
*
pos
,
*
n
;
struct
mount
*
m
=
real_mount
(
mnt
);
LIST_HEAD
(
free_list
);
spin_lock
(
&
mnt
->
mnt_root
->
d_lock
);
hlist_for_each_entry_safe
(
mark
,
pos
,
n
,
&
m
nt
->
mnt_fsnotify_marks
,
m
.
m_list
)
{
hlist_for_each_entry_safe
(
mark
,
pos
,
n
,
&
m
->
mnt_fsnotify_marks
,
m
.
m_list
)
{
list_add
(
&
mark
->
m
.
free_m_list
,
&
free_list
);
hlist_del_init_rcu
(
&
mark
->
m
.
m_list
);
fsnotify_get_mark
(
mark
);
...
...
@@ -59,15 +61,16 @@ void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group)
*/
static
void
fsnotify_recalc_vfsmount_mask_locked
(
struct
vfsmount
*
mnt
)
{
struct
mount
*
m
=
real_mount
(
mnt
);
struct
fsnotify_mark
*
mark
;
struct
hlist_node
*
pos
;
__u32
new_mask
=
0
;
assert_spin_locked
(
&
mnt
->
mnt_root
->
d_lock
);
hlist_for_each_entry
(
mark
,
pos
,
&
m
nt
->
mnt_fsnotify_marks
,
m
.
m_list
)
hlist_for_each_entry
(
mark
,
pos
,
&
m
->
mnt_fsnotify_marks
,
m
.
m_list
)
new_mask
|=
mark
->
mask
;
m
nt
->
mnt_fsnotify_mask
=
new_mask
;
m
->
mnt_fsnotify_mask
=
new_mask
;
}
/*
...
...
@@ -101,12 +104,13 @@ void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark)
static
struct
fsnotify_mark
*
fsnotify_find_vfsmount_mark_locked
(
struct
fsnotify_group
*
group
,
struct
vfsmount
*
mnt
)
{
struct
mount
*
m
=
real_mount
(
mnt
);
struct
fsnotify_mark
*
mark
;
struct
hlist_node
*
pos
;
assert_spin_locked
(
&
mnt
->
mnt_root
->
d_lock
);
hlist_for_each_entry
(
mark
,
pos
,
&
m
nt
->
mnt_fsnotify_marks
,
m
.
m_list
)
{
hlist_for_each_entry
(
mark
,
pos
,
&
m
->
mnt_fsnotify_marks
,
m
.
m_list
)
{
if
(
mark
->
group
==
group
)
{
fsnotify_get_mark
(
mark
);
return
mark
;
...
...
@@ -140,6 +144,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
struct
fsnotify_group
*
group
,
struct
vfsmount
*
mnt
,
int
allow_dups
)
{
struct
mount
*
m
=
real_mount
(
mnt
);
struct
fsnotify_mark
*
lmark
;
struct
hlist_node
*
node
,
*
last
=
NULL
;
int
ret
=
0
;
...
...
@@ -154,13 +159,13 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
mark
->
m
.
mnt
=
mnt
;
/* is mark the first mark? */
if
(
hlist_empty
(
&
m
nt
->
mnt_fsnotify_marks
))
{
hlist_add_head_rcu
(
&
mark
->
m
.
m_list
,
&
m
nt
->
mnt_fsnotify_marks
);
if
(
hlist_empty
(
&
m
->
mnt_fsnotify_marks
))
{
hlist_add_head_rcu
(
&
mark
->
m
.
m_list
,
&
m
->
mnt_fsnotify_marks
);
goto
out
;
}
/* should mark be in the middle of the current list? */
hlist_for_each_entry
(
lmark
,
node
,
&
m
nt
->
mnt_fsnotify_marks
,
m
.
m_list
)
{
hlist_for_each_entry
(
lmark
,
node
,
&
m
->
mnt_fsnotify_marks
,
m
.
m_list
)
{
last
=
node
;
if
((
lmark
->
group
==
group
)
&&
!
allow_dups
)
{
...
...
include/linux/mount.h
浏览文件 @
c63181e6
...
...
@@ -51,11 +51,6 @@ struct vfsmount {
struct
dentry
*
mnt_root
;
/* root of the mounted tree */
struct
super_block
*
mnt_sb
;
/* pointer to superblock */
int
mnt_flags
;
/* 4 bytes hole on 64bits arches without fsnotify */
#ifdef CONFIG_FSNOTIFY
__u32
mnt_fsnotify_mask
;
struct
hlist_head
mnt_fsnotify_marks
;
#endif
};
struct
file
;
/* forward dec */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录