Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
68e8a9fe
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
68e8a9fe
编写于
11月 24, 2011
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vfs: all counters taken to struct mount
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
83adc753
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
32 addition
and
32 deletion
+32
-32
fs/mount.h
fs/mount.h
+12
-0
fs/namespace.c
fs/namespace.c
+20
-20
include/linux/mount.h
include/linux/mount.h
+0
-12
未找到文件。
fs/mount.h
浏览文件 @
68e8a9fe
#include <linux/mount.h>
#include <linux/mount.h>
struct
mnt_pcp
{
int
mnt_count
;
int
mnt_writers
;
};
struct
mount
{
struct
mount
{
struct
list_head
mnt_hash
;
struct
list_head
mnt_hash
;
struct
mount
*
mnt_parent
;
struct
mount
*
mnt_parent
;
struct
dentry
*
mnt_mountpoint
;
struct
dentry
*
mnt_mountpoint
;
struct
vfsmount
mnt
;
struct
vfsmount
mnt
;
#ifdef CONFIG_SMP
struct
mnt_pcp
__percpu
*
mnt_pcp
;
atomic_t
mnt_longterm
;
/* how many of the refs are longterm */
#else
int
mnt_count
;
int
mnt_writers
;
#endif
};
};
static
inline
struct
mount
*
real_mount
(
struct
vfsmount
*
mnt
)
static
inline
struct
mount
*
real_mount
(
struct
vfsmount
*
mnt
)
...
...
fs/namespace.c
浏览文件 @
68e8a9fe
...
@@ -144,10 +144,10 @@ void mnt_release_group_id(struct mount *mnt)
...
@@ -144,10 +144,10 @@ void mnt_release_group_id(struct mount *mnt)
static
inline
void
mnt_add_count
(
struct
mount
*
mnt
,
int
n
)
static
inline
void
mnt_add_count
(
struct
mount
*
mnt
,
int
n
)
{
{
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
this_cpu_add
(
mnt
->
mnt
.
mnt
_pcp
->
mnt_count
,
n
);
this_cpu_add
(
mnt
->
mnt_pcp
->
mnt_count
,
n
);
#else
#else
preempt_disable
();
preempt_disable
();
mnt
->
mnt
.
mnt
_count
+=
n
;
mnt
->
mnt_count
+=
n
;
preempt_enable
();
preempt_enable
();
#endif
#endif
}
}
...
@@ -162,12 +162,12 @@ unsigned int mnt_get_count(struct mount *mnt)
...
@@ -162,12 +162,12 @@ unsigned int mnt_get_count(struct mount *mnt)
int
cpu
;
int
cpu
;
for_each_possible_cpu
(
cpu
)
{
for_each_possible_cpu
(
cpu
)
{
count
+=
per_cpu_ptr
(
mnt
->
mnt
.
mnt
_pcp
,
cpu
)
->
mnt_count
;
count
+=
per_cpu_ptr
(
mnt
->
mnt_pcp
,
cpu
)
->
mnt_count
;
}
}
return
count
;
return
count
;
#else
#else
return
mnt
->
mnt
.
mnt
_count
;
return
mnt
->
mnt_count
;
#endif
#endif
}
}
...
@@ -189,14 +189,14 @@ static struct mount *alloc_vfsmnt(const char *name)
...
@@ -189,14 +189,14 @@ static struct mount *alloc_vfsmnt(const char *name)
}
}
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
mnt
->
mnt_pcp
=
alloc_percpu
(
struct
mnt_pcp
);
p
->
mnt_pcp
=
alloc_percpu
(
struct
mnt_pcp
);
if
(
!
mnt
->
mnt_pcp
)
if
(
!
p
->
mnt_pcp
)
goto
out_free_devname
;
goto
out_free_devname
;
this_cpu_add
(
mnt
->
mnt_pcp
->
mnt_count
,
1
);
this_cpu_add
(
p
->
mnt_pcp
->
mnt_count
,
1
);
#else
#else
mnt
->
mnt_count
=
1
;
p
->
mnt_count
=
1
;
mnt
->
mnt_writers
=
0
;
p
->
mnt_writers
=
0
;
#endif
#endif
INIT_LIST_HEAD
(
&
p
->
mnt_hash
);
INIT_LIST_HEAD
(
&
p
->
mnt_hash
);
...
@@ -256,18 +256,18 @@ EXPORT_SYMBOL_GPL(__mnt_is_readonly);
...
@@ -256,18 +256,18 @@ EXPORT_SYMBOL_GPL(__mnt_is_readonly);
static
inline
void
mnt_inc_writers
(
struct
mount
*
mnt
)
static
inline
void
mnt_inc_writers
(
struct
mount
*
mnt
)
{
{
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
this_cpu_inc
(
mnt
->
mnt
.
mnt
_pcp
->
mnt_writers
);
this_cpu_inc
(
mnt
->
mnt_pcp
->
mnt_writers
);
#else
#else
mnt
->
mnt
.
mnt
_writers
++
;
mnt
->
mnt_writers
++
;
#endif
#endif
}
}
static
inline
void
mnt_dec_writers
(
struct
mount
*
mnt
)
static
inline
void
mnt_dec_writers
(
struct
mount
*
mnt
)
{
{
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
this_cpu_dec
(
mnt
->
mnt
.
mnt
_pcp
->
mnt_writers
);
this_cpu_dec
(
mnt
->
mnt_pcp
->
mnt_writers
);
#else
#else
mnt
->
mnt
.
mnt
_writers
--
;
mnt
->
mnt_writers
--
;
#endif
#endif
}
}
...
@@ -278,7 +278,7 @@ static unsigned int mnt_get_writers(struct mount *mnt)
...
@@ -278,7 +278,7 @@ static unsigned int mnt_get_writers(struct mount *mnt)
int
cpu
;
int
cpu
;
for_each_possible_cpu
(
cpu
)
{
for_each_possible_cpu
(
cpu
)
{
count
+=
per_cpu_ptr
(
mnt
->
mnt
.
mnt
_pcp
,
cpu
)
->
mnt_writers
;
count
+=
per_cpu_ptr
(
mnt
->
mnt_pcp
,
cpu
)
->
mnt_writers
;
}
}
return
count
;
return
count
;
...
@@ -454,7 +454,7 @@ static void free_vfsmnt(struct mount *mnt)
...
@@ -454,7 +454,7 @@ static void free_vfsmnt(struct mount *mnt)
kfree
(
mnt
->
mnt
.
mnt_devname
);
kfree
(
mnt
->
mnt
.
mnt_devname
);
mnt_free_id
(
mnt
);
mnt_free_id
(
mnt
);
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
free_percpu
(
mnt
->
mnt
.
mnt
_pcp
);
free_percpu
(
mnt
->
mnt_pcp
);
#endif
#endif
kmem_cache_free
(
mnt_cache
,
mnt
);
kmem_cache_free
(
mnt_cache
,
mnt
);
}
}
...
@@ -594,7 +594,7 @@ static void attach_mnt(struct mount *mnt, struct path *path)
...
@@ -594,7 +594,7 @@ static void attach_mnt(struct mount *mnt, struct path *path)
static
inline
void
__mnt_make_longterm
(
struct
mount
*
mnt
)
static
inline
void
__mnt_make_longterm
(
struct
mount
*
mnt
)
{
{
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
atomic_inc
(
&
mnt
->
mnt
.
mnt
_longterm
);
atomic_inc
(
&
mnt
->
mnt_longterm
);
#endif
#endif
}
}
...
@@ -602,7 +602,7 @@ static inline void __mnt_make_longterm(struct mount *mnt)
...
@@ -602,7 +602,7 @@ static inline void __mnt_make_longterm(struct mount *mnt)
static
inline
void
__mnt_make_shortterm
(
struct
mount
*
mnt
)
static
inline
void
__mnt_make_shortterm
(
struct
mount
*
mnt
)
{
{
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
atomic_dec
(
&
mnt
->
mnt
.
mnt
_longterm
);
atomic_dec
(
&
mnt
->
mnt_longterm
);
#endif
#endif
}
}
...
@@ -769,7 +769,7 @@ static void mntput_no_expire(struct vfsmount *m)
...
@@ -769,7 +769,7 @@ static void mntput_no_expire(struct vfsmount *m)
put_again:
put_again:
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
br_read_lock
(
vfsmount_lock
);
br_read_lock
(
vfsmount_lock
);
if
(
likely
(
atomic_read
(
&
mnt
->
mnt
.
mnt
_longterm
)))
{
if
(
likely
(
atomic_read
(
&
mnt
->
mnt_longterm
)))
{
mnt_add_count
(
mnt
,
-
1
);
mnt_add_count
(
mnt
,
-
1
);
br_read_unlock
(
vfsmount_lock
);
br_read_unlock
(
vfsmount_lock
);
return
;
return
;
...
@@ -2375,10 +2375,10 @@ void mnt_make_shortterm(struct vfsmount *m)
...
@@ -2375,10 +2375,10 @@ void mnt_make_shortterm(struct vfsmount *m)
{
{
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
struct
mount
*
mnt
=
real_mount
(
m
);
struct
mount
*
mnt
=
real_mount
(
m
);
if
(
atomic_add_unless
(
&
mnt
->
mnt
.
mnt
_longterm
,
-
1
,
1
))
if
(
atomic_add_unless
(
&
mnt
->
mnt_longterm
,
-
1
,
1
))
return
;
return
;
br_write_lock
(
vfsmount_lock
);
br_write_lock
(
vfsmount_lock
);
atomic_dec
(
&
mnt
->
mnt
.
mnt
_longterm
);
atomic_dec
(
&
mnt
->
mnt_longterm
);
br_write_unlock
(
vfsmount_lock
);
br_write_unlock
(
vfsmount_lock
);
#endif
#endif
}
}
...
...
include/linux/mount.h
浏览文件 @
68e8a9fe
...
@@ -47,21 +47,9 @@ struct mnt_namespace;
...
@@ -47,21 +47,9 @@ struct mnt_namespace;
#define MNT_INTERNAL 0x4000
#define MNT_INTERNAL 0x4000
struct
mnt_pcp
{
int
mnt_count
;
int
mnt_writers
;
};
struct
vfsmount
{
struct
vfsmount
{
struct
dentry
*
mnt_root
;
/* root of the mounted tree */
struct
dentry
*
mnt_root
;
/* root of the mounted tree */
struct
super_block
*
mnt_sb
;
/* pointer to superblock */
struct
super_block
*
mnt_sb
;
/* pointer to superblock */
#ifdef CONFIG_SMP
struct
mnt_pcp
__percpu
*
mnt_pcp
;
atomic_t
mnt_longterm
;
/* how many of the refs are longterm */
#else
int
mnt_count
;
int
mnt_writers
;
#endif
struct
list_head
mnt_mounts
;
/* list of children, anchored here */
struct
list_head
mnt_mounts
;
/* list of children, anchored here */
struct
list_head
mnt_child
;
/* and going through their mnt_child */
struct
list_head
mnt_child
;
/* and going through their mnt_child */
int
mnt_flags
;
int
mnt_flags
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录