Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
a5166169
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a5166169
编写于
12月 12, 2011
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vfs: convert fs_supers to hlist
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
5352d3b6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
15 deletion
+16
-15
fs/filesystems.c
fs/filesystems.c
+0
-1
fs/super.c
fs/super.c
+14
-12
include/linux/fs.h
include/linux/fs.h
+2
-2
未找到文件。
fs/filesystems.c
浏览文件 @
a5166169
...
...
@@ -74,7 +74,6 @@ int register_filesystem(struct file_system_type * fs)
BUG_ON
(
strchr
(
fs
->
name
,
'.'
));
if
(
fs
->
next
)
return
-
EBUSY
;
INIT_LIST_HEAD
(
&
fs
->
fs_supers
);
write_lock
(
&
file_systems_lock
);
p
=
find_filesystem
(
fs
->
name
,
strlen
(
fs
->
name
));
if
(
*
p
)
...
...
fs/super.c
浏览文件 @
a5166169
...
...
@@ -136,7 +136,7 @@ static struct super_block *alloc_super(struct file_system_type *type)
INIT_LIST_HEAD
(
&
s
->
s_files
);
#endif
s
->
s_bdi
=
&
default_backing_dev_info
;
INIT_
LIST_HEAD
(
&
s
->
s_instances
);
INIT_
HLIST_NODE
(
&
s
->
s_instances
);
INIT_HLIST_BL_HEAD
(
&
s
->
s_anon
);
INIT_LIST_HEAD
(
&
s
->
s_inodes
);
INIT_LIST_HEAD
(
&
s
->
s_dentry_lru
);
...
...
@@ -328,7 +328,7 @@ static int grab_super(struct super_block *s) __releases(sb_lock)
bool
grab_super_passive
(
struct
super_block
*
sb
)
{
spin_lock
(
&
sb_lock
);
if
(
list_empty
(
&
sb
->
s_instances
))
{
if
(
hlist_unhashed
(
&
sb
->
s_instances
))
{
spin_unlock
(
&
sb_lock
);
return
false
;
}
...
...
@@ -400,7 +400,7 @@ void generic_shutdown_super(struct super_block *sb)
}
spin_lock
(
&
sb_lock
);
/* should be initialized for __put_super_and_need_restart() */
list_del_init
(
&
sb
->
s_instances
);
h
list_del_init
(
&
sb
->
s_instances
);
spin_unlock
(
&
sb_lock
);
up_write
(
&
sb
->
s_umount
);
}
...
...
@@ -420,13 +420,14 @@ struct super_block *sget(struct file_system_type *type,
void
*
data
)
{
struct
super_block
*
s
=
NULL
;
struct
hlist_node
*
node
;
struct
super_block
*
old
;
int
err
;
retry:
spin_lock
(
&
sb_lock
);
if
(
test
)
{
list_for_each_entry
(
old
,
&
type
->
fs_supers
,
s_instances
)
{
hlist_for_each_entry
(
old
,
node
,
&
type
->
fs_supers
,
s_instances
)
{
if
(
!
test
(
old
,
data
))
continue
;
if
(
!
grab_super
(
old
))
...
...
@@ -462,7 +463,7 @@ struct super_block *sget(struct file_system_type *type,
s
->
s_type
=
type
;
strlcpy
(
s
->
s_id
,
type
->
name
,
sizeof
(
s
->
s_id
));
list_add_tail
(
&
s
->
s_list
,
&
super_blocks
);
list_ad
d
(
&
s
->
s_instances
,
&
type
->
fs_supers
);
hlist_add_hea
d
(
&
s
->
s_instances
,
&
type
->
fs_supers
);
spin_unlock
(
&
sb_lock
);
get_filesystem
(
type
);
register_shrinker
(
&
s
->
s_shrink
);
...
...
@@ -497,7 +498,7 @@ void sync_supers(void)
spin_lock
(
&
sb_lock
);
list_for_each_entry
(
sb
,
&
super_blocks
,
s_list
)
{
if
(
list_empty
(
&
sb
->
s_instances
))
if
(
hlist_unhashed
(
&
sb
->
s_instances
))
continue
;
if
(
sb
->
s_op
->
write_super
&&
sb
->
s_dirt
)
{
sb
->
s_count
++
;
...
...
@@ -533,7 +534,7 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg)
spin_lock
(
&
sb_lock
);
list_for_each_entry
(
sb
,
&
super_blocks
,
s_list
)
{
if
(
list_empty
(
&
sb
->
s_instances
))
if
(
hlist_unhashed
(
&
sb
->
s_instances
))
continue
;
sb
->
s_count
++
;
spin_unlock
(
&
sb_lock
);
...
...
@@ -566,9 +567,10 @@ void iterate_supers_type(struct file_system_type *type,
void
(
*
f
)(
struct
super_block
*
,
void
*
),
void
*
arg
)
{
struct
super_block
*
sb
,
*
p
=
NULL
;
struct
hlist_node
*
node
;
spin_lock
(
&
sb_lock
);
list_for_each_entry
(
sb
,
&
type
->
fs_supers
,
s_instances
)
{
hlist_for_each_entry
(
sb
,
node
,
&
type
->
fs_supers
,
s_instances
)
{
sb
->
s_count
++
;
spin_unlock
(
&
sb_lock
);
...
...
@@ -607,7 +609,7 @@ struct super_block *get_super(struct block_device *bdev)
spin_lock
(
&
sb_lock
);
rescan:
list_for_each_entry
(
sb
,
&
super_blocks
,
s_list
)
{
if
(
list_empty
(
&
sb
->
s_instances
))
if
(
hlist_unhashed
(
&
sb
->
s_instances
))
continue
;
if
(
sb
->
s_bdev
==
bdev
)
{
sb
->
s_count
++
;
...
...
@@ -647,7 +649,7 @@ struct super_block *get_active_super(struct block_device *bdev)
restart:
spin_lock
(
&
sb_lock
);
list_for_each_entry
(
sb
,
&
super_blocks
,
s_list
)
{
if
(
list_empty
(
&
sb
->
s_instances
))
if
(
hlist_unhashed
(
&
sb
->
s_instances
))
continue
;
if
(
sb
->
s_bdev
==
bdev
)
{
if
(
grab_super
(
sb
))
/* drops sb_lock */
...
...
@@ -667,7 +669,7 @@ struct super_block *user_get_super(dev_t dev)
spin_lock
(
&
sb_lock
);
rescan:
list_for_each_entry
(
sb
,
&
super_blocks
,
s_list
)
{
if
(
list_empty
(
&
sb
->
s_instances
))
if
(
hlist_unhashed
(
&
sb
->
s_instances
))
continue
;
if
(
sb
->
s_dev
==
dev
)
{
sb
->
s_count
++
;
...
...
@@ -756,7 +758,7 @@ static void do_emergency_remount(struct work_struct *work)
spin_lock
(
&
sb_lock
);
list_for_each_entry
(
sb
,
&
super_blocks
,
s_list
)
{
if
(
list_empty
(
&
sb
->
s_instances
))
if
(
hlist_unhashed
(
&
sb
->
s_instances
))
continue
;
sb
->
s_count
++
;
spin_unlock
(
&
sb_lock
);
...
...
include/linux/fs.h
浏览文件 @
a5166169
...
...
@@ -1440,7 +1440,7 @@ struct super_block {
struct
block_device
*
s_bdev
;
struct
backing_dev_info
*
s_bdi
;
struct
mtd_info
*
s_mtd
;
struct
list_head
s_instances
;
struct
hlist_node
s_instances
;
struct
quota_info
s_dquot
;
/* Diskquota specific options */
int
s_frozen
;
...
...
@@ -1864,7 +1864,7 @@ struct file_system_type {
void
(
*
kill_sb
)
(
struct
super_block
*
);
struct
module
*
owner
;
struct
file_system_type
*
next
;
struct
list_head
fs_supers
;
struct
h
list_head
fs_supers
;
struct
lock_class_key
s_lock_key
;
struct
lock_class_key
s_umount_key
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录