Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
6776db3d
C
clone-Linux
项目概览
gsplhtlxg
/
clone-Linux
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
clone-Linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6776db3d
编写于
11月 25, 2011
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vfs: take mnt_share/mnt_slave/mnt_slave_list and mnt_expire to struct mount
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
32301920
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
40 deletion
+41
-40
fs/mount.h
fs/mount.h
+5
-1
fs/namespace.c
fs/namespace.c
+21
-20
fs/pnode.c
fs/pnode.c
+15
-15
include/linux/mount.h
include/linux/mount.h
+0
-4
未找到文件。
fs/mount.h
浏览文件 @
6776db3d
...
...
@@ -19,7 +19,11 @@ 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 - up to mnt_slave */
/* yet to be moved - up to mnt_list */
struct
list_head
mnt_expire
;
/* link in fs-specific expiry list */
struct
list_head
mnt_share
;
/* circular list of shared mounts */
struct
list_head
mnt_slave_list
;
/* list of slave mounts */
struct
list_head
mnt_slave
;
/* slave list entry */
struct
mount
*
mnt_master
;
/* slave is on master->mnt_slave_list */
};
...
...
fs/namespace.c
浏览文件 @
6776db3d
...
...
@@ -203,10 +203,10 @@ static struct mount *alloc_vfsmnt(const char *name)
INIT_LIST_HEAD
(
&
p
->
mnt_child
);
INIT_LIST_HEAD
(
&
p
->
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
);
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
);
#ifdef CONFIG_FSNOTIFY
INIT_HLIST_HEAD
(
&
mnt
->
mnt_fsnotify_marks
);
#endif
...
...
@@ -714,14 +714,14 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
mnt
->
mnt_parent
=
mnt
;
if
(
flag
&
CL_SLAVE
)
{
list_add
(
&
mnt
->
mnt
.
mnt_slave
,
&
old
->
mnt
.
mnt_slave_list
);
list_add
(
&
mnt
->
mnt
_slave
,
&
old
->
mnt_slave_list
);
mnt
->
mnt_master
=
old
;
CLEAR_MNT_SHARED
(
&
mnt
->
mnt
);
}
else
if
(
!
(
flag
&
CL_PRIVATE
))
{
if
((
flag
&
CL_MAKE_SHARED
)
||
IS_MNT_SHARED
(
&
old
->
mnt
))
list_add
(
&
mnt
->
mnt
.
mnt_share
,
&
old
->
mnt
.
mnt_share
);
list_add
(
&
mnt
->
mnt
_share
,
&
old
->
mnt_share
);
if
(
IS_MNT_SLAVE
(
old
))
list_add
(
&
mnt
->
mnt
.
mnt_slave
,
&
old
->
mnt
.
mnt_slave
);
list_add
(
&
mnt
->
mnt
_slave
,
&
old
->
mnt_slave
);
mnt
->
mnt_master
=
old
->
mnt_master
;
}
if
(
flag
&
CL_MAKE_SHARED
)
...
...
@@ -730,8 +730,8 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
/* stick the duplicate mount on the same expiry list
* as the original if that was on one */
if
(
flag
&
CL_EXPIRE
)
{
if
(
!
list_empty
(
&
old
->
mnt
.
mnt
_expire
))
list_add
(
&
mnt
->
mnt
.
mnt_expire
,
&
old
->
mnt
.
mnt_expire
);
if
(
!
list_empty
(
&
old
->
mnt_expire
))
list_add
(
&
mnt
->
mnt
_expire
,
&
old
->
mnt_expire
);
}
}
return
mnt
;
...
...
@@ -1233,7 +1233,7 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)
propagate_umount
(
&
tmp_list
);
list_for_each_entry
(
p
,
&
tmp_list
,
mnt_hash
)
{
list_del_init
(
&
p
->
mnt
.
mnt
_expire
);
list_del_init
(
&
p
->
mnt_expire
);
list_del_init
(
&
p
->
mnt
.
mnt_list
);
__touch_mnt_namespace
(
p
->
mnt
.
mnt_ns
);
p
->
mnt
.
mnt_ns
=
NULL
;
...
...
@@ -1921,7 +1921,7 @@ static int do_move_mount(struct path *path, char *old_name)
/* if the mount is moved, it should no longer be expire
* automatically */
list_del_init
(
&
old
_path
.
mnt
->
mnt_expire
);
list_del_init
(
&
old
->
mnt_expire
);
out1:
unlock_mount
(
path
);
out:
...
...
@@ -2033,11 +2033,12 @@ static int do_new_mount(struct path *path, char *type, int flags,
int
finish_automount
(
struct
vfsmount
*
m
,
struct
path
*
path
)
{
struct
mount
*
mnt
=
real_mount
(
m
);
int
err
;
/* The new mount record should have at least 2 refs to prevent it being
* expired before we get a chance to add it
*/
BUG_ON
(
mnt_get_count
(
real_mount
(
m
)
)
<
2
);
BUG_ON
(
mnt_get_count
(
mnt
)
<
2
);
if
(
m
->
mnt_sb
==
path
->
mnt
->
mnt_sb
&&
m
->
mnt_root
==
path
->
dentry
)
{
...
...
@@ -2050,10 +2051,10 @@ int finish_automount(struct vfsmount *m, struct path *path)
return
0
;
fail:
/* remove m from any expiration list it may be on */
if
(
!
list_empty
(
&
m
->
mnt_expire
))
{
if
(
!
list_empty
(
&
m
nt
->
mnt_expire
))
{
down_write
(
&
namespace_sem
);
br_write_lock
(
vfsmount_lock
);
list_del_init
(
&
m
->
mnt_expire
);
list_del_init
(
&
m
nt
->
mnt_expire
);
br_write_unlock
(
vfsmount_lock
);
up_write
(
&
namespace_sem
);
}
...
...
@@ -2072,7 +2073,7 @@ void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list)
down_write
(
&
namespace_sem
);
br_write_lock
(
vfsmount_lock
);
list_add_tail
(
&
mnt
->
mnt_expire
,
expiry_list
);
list_add_tail
(
&
real_mount
(
mnt
)
->
mnt_expire
,
expiry_list
);
br_write_unlock
(
vfsmount_lock
);
up_write
(
&
namespace_sem
);
...
...
@@ -2102,14 +2103,14 @@ void mark_mounts_for_expiry(struct list_head *mounts)
* - still marked for expiry (marked on the last call here; marks are
* cleared by mntput())
*/
list_for_each_entry_safe
(
mnt
,
next
,
mounts
,
mnt
.
mnt
_expire
)
{
list_for_each_entry_safe
(
mnt
,
next
,
mounts
,
mnt_expire
)
{
if
(
!
xchg
(
&
mnt
->
mnt
.
mnt_expiry_mark
,
1
)
||
propagate_mount_busy
(
mnt
,
1
))
continue
;
list_move
(
&
mnt
->
mnt
.
mnt
_expire
,
&
graveyard
);
list_move
(
&
mnt
->
mnt_expire
,
&
graveyard
);
}
while
(
!
list_empty
(
&
graveyard
))
{
mnt
=
list_first_entry
(
&
graveyard
,
struct
mount
,
mnt
.
mnt
_expire
);
mnt
=
list_first_entry
(
&
graveyard
,
struct
mount
,
mnt_expire
);
touch_mnt_namespace
(
mnt
->
mnt
.
mnt_ns
);
umount_tree
(
mnt
,
1
,
&
umounts
);
}
...
...
@@ -2152,7 +2153,7 @@ static int select_submounts(struct mount *parent, struct list_head *graveyard)
}
if
(
!
propagate_mount_busy
(
mnt
,
1
))
{
list_move_tail
(
&
mnt
->
mnt
.
mnt
_expire
,
graveyard
);
list_move_tail
(
&
mnt
->
mnt_expire
,
graveyard
);
found
++
;
}
}
...
...
@@ -2182,7 +2183,7 @@ static void shrink_submounts(struct mount *mnt, struct list_head *umounts)
while
(
select_submounts
(
mnt
,
&
graveyard
))
{
while
(
!
list_empty
(
&
graveyard
))
{
m
=
list_first_entry
(
&
graveyard
,
struct
mount
,
mnt
.
mnt
_expire
);
mnt_expire
);
touch_mnt_namespace
(
m
->
mnt
.
mnt_ns
);
umount_tree
(
m
,
1
,
umounts
);
}
...
...
fs/pnode.c
浏览文件 @
6776db3d
...
...
@@ -15,17 +15,17 @@
/* return the next shared peer mount of @p */
static
inline
struct
mount
*
next_peer
(
struct
mount
*
p
)
{
return
list_entry
(
p
->
mnt
.
mnt_share
.
next
,
struct
mount
,
mnt
.
mnt_share
);
return
list_entry
(
p
->
mnt
_share
.
next
,
struct
mount
,
mnt_share
);
}
static
inline
struct
mount
*
first_slave
(
struct
mount
*
p
)
{
return
list_entry
(
p
->
mnt
.
mnt_slave_list
.
next
,
struct
mount
,
mnt
.
mnt_slave
);
return
list_entry
(
p
->
mnt
_slave_list
.
next
,
struct
mount
,
mnt_slave
);
}
static
inline
struct
mount
*
next_slave
(
struct
mount
*
p
)
{
return
list_entry
(
p
->
mnt
.
mnt_slave
.
next
,
struct
mount
,
mnt
.
mnt_slave
);
return
list_entry
(
p
->
mnt
_slave
.
next
,
struct
mount
,
mnt_slave
);
}
static
struct
mount
*
get_peer_under_root
(
struct
mount
*
mnt
,
...
...
@@ -82,27 +82,27 @@ static int do_make_slave(struct mount *mnt)
if
(
peer_mnt
==
mnt
)
peer_mnt
=
NULL
;
}
if
(
IS_MNT_SHARED
(
&
mnt
->
mnt
)
&&
list_empty
(
&
mnt
->
mnt
.
mnt
_share
))
if
(
IS_MNT_SHARED
(
&
mnt
->
mnt
)
&&
list_empty
(
&
mnt
->
mnt_share
))
mnt_release_group_id
(
mnt
);
list_del_init
(
&
mnt
->
mnt
.
mnt
_share
);
list_del_init
(
&
mnt
->
mnt_share
);
mnt
->
mnt
.
mnt_group_id
=
0
;
if
(
peer_mnt
)
master
=
peer_mnt
;
if
(
master
)
{
list_for_each_entry
(
slave_mnt
,
&
mnt
->
mnt
.
mnt_slave_list
,
mnt
.
mnt_slave
)
list_for_each_entry
(
slave_mnt
,
&
mnt
->
mnt
_slave_list
,
mnt_slave
)
slave_mnt
->
mnt_master
=
master
;
list_move
(
&
mnt
->
mnt
.
mnt_slave
,
&
master
->
mnt
.
mnt_slave_list
);
list_splice
(
&
mnt
->
mnt
.
mnt_slave_list
,
master
->
mnt
.
mnt_slave_list
.
prev
);
INIT_LIST_HEAD
(
&
mnt
->
mnt
.
mnt
_slave_list
);
list_move
(
&
mnt
->
mnt
_slave
,
&
master
->
mnt_slave_list
);
list_splice
(
&
mnt
->
mnt
_slave_list
,
master
->
mnt_slave_list
.
prev
);
INIT_LIST_HEAD
(
&
mnt
->
mnt_slave_list
);
}
else
{
struct
list_head
*
p
=
&
mnt
->
mnt
.
mnt
_slave_list
;
struct
list_head
*
p
=
&
mnt
->
mnt_slave_list
;
while
(
!
list_empty
(
p
))
{
slave_mnt
=
list_first_entry
(
p
,
struct
mount
,
mnt
.
mnt
_slave
);
list_del_init
(
&
slave_mnt
->
mnt
.
mnt
_slave
);
struct
mount
,
mnt_slave
);
list_del_init
(
&
slave_mnt
->
mnt_slave
);
slave_mnt
->
mnt_master
=
NULL
;
}
}
...
...
@@ -122,7 +122,7 @@ void change_mnt_propagation(struct mount *mnt, int type)
}
do_make_slave
(
mnt
);
if
(
type
!=
MS_SLAVE
)
{
list_del_init
(
&
mnt
->
mnt
.
mnt
_slave
);
list_del_init
(
&
mnt
->
mnt_slave
);
mnt
->
mnt_master
=
NULL
;
if
(
type
==
MS_UNBINDABLE
)
mnt
->
mnt
.
mnt_flags
|=
MNT_UNBINDABLE
;
...
...
@@ -145,7 +145,7 @@ static struct mount *propagation_next(struct mount *m,
struct
mount
*
origin
)
{
/* are there any slaves of this mount? */
if
(
!
IS_MNT_NEW
(
&
m
->
mnt
)
&&
!
list_empty
(
&
m
->
mnt
.
mnt
_slave_list
))
if
(
!
IS_MNT_NEW
(
&
m
->
mnt
)
&&
!
list_empty
(
&
m
->
mnt_slave_list
))
return
first_slave
(
m
);
while
(
1
)
{
...
...
@@ -154,7 +154,7 @@ static struct mount *propagation_next(struct mount *m,
if
(
master
==
origin
->
mnt_master
)
{
struct
mount
*
next
=
next_peer
(
m
);
return
(
next
==
origin
)
?
NULL
:
next
;
}
else
if
(
m
->
mnt
.
mnt_slave
.
next
!=
&
master
->
mnt
.
mnt_slave_list
)
}
else
if
(
m
->
mnt
_slave
.
next
!=
&
master
->
mnt_slave_list
)
return
next_slave
(
m
);
/* back at master */
...
...
include/linux/mount.h
浏览文件 @
6776db3d
...
...
@@ -58,10 +58,6 @@ struct vfsmount {
#endif
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 */
struct
list_head
mnt_share
;
/* circular list of shared mounts */
struct
list_head
mnt_slave_list
;
/* list of slave mounts */
struct
list_head
mnt_slave
;
/* slave list entry */
struct
mnt_namespace
*
mnt_ns
;
/* containing namespace */
int
mnt_id
;
/* mount identifier */
int
mnt_group_id
;
/* peer group identifier */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录