Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
5dd12af0
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5dd12af0
编写于
4月 24, 2011
作者:
L
Linus Torvalds
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dcache-cleanup'
* dcache-cleanup: vfs: get rid of insane dentry hashing rules
上级
8f754468
dea3667b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
28 deletion
+18
-28
fs/dcache.c
fs/dcache.c
+16
-26
include/linux/dcache.h
include/linux/dcache.h
+2
-2
未找到文件。
fs/dcache.c
浏览文件 @
5dd12af0
...
@@ -164,8 +164,8 @@ static void d_free(struct dentry *dentry)
...
@@ -164,8 +164,8 @@ static void d_free(struct dentry *dentry)
if
(
dentry
->
d_op
&&
dentry
->
d_op
->
d_release
)
if
(
dentry
->
d_op
&&
dentry
->
d_op
->
d_release
)
dentry
->
d_op
->
d_release
(
dentry
);
dentry
->
d_op
->
d_release
(
dentry
);
/* if dentry was never
inserted into hash
, immediate free is OK */
/* if dentry was never
visible to RCU
, immediate free is OK */
if
(
hlist_bl_unhashed
(
&
dentry
->
d_hash
))
if
(
!
(
dentry
->
d_flags
&
DCACHE_RCUACCESS
))
__d_free
(
&
dentry
->
d_u
.
d_rcu
);
__d_free
(
&
dentry
->
d_u
.
d_rcu
);
else
else
call_rcu
(
&
dentry
->
d_u
.
d_rcu
,
__d_free
);
call_rcu
(
&
dentry
->
d_u
.
d_rcu
,
__d_free
);
...
@@ -327,28 +327,19 @@ static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent)
...
@@ -327,28 +327,19 @@ static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent)
*/
*/
void
__d_drop
(
struct
dentry
*
dentry
)
void
__d_drop
(
struct
dentry
*
dentry
)
{
{
if
(
!
(
dentry
->
d_flags
&
DCACHE_UNHASHED
))
{
if
(
!
d_unhashed
(
dentry
))
{
struct
hlist_bl_head
*
b
;
struct
hlist_bl_head
*
b
;
if
(
unlikely
(
dentry
->
d_flags
&
DCACHE_DISCONNECTED
))
{
if
(
unlikely
(
dentry
->
d_flags
&
DCACHE_DISCONNECTED
))
b
=
&
dentry
->
d_sb
->
s_anon
;
b
=
&
dentry
->
d_sb
->
s_anon
;
spin_lock_bucket
(
b
);
else
dentry
->
d_flags
|=
DCACHE_UNHASHED
;
hlist_bl_del_init
(
&
dentry
->
d_hash
);
spin_unlock_bucket
(
b
);
}
else
{
struct
hlist_bl_head
*
b
;
b
=
d_hash
(
dentry
->
d_parent
,
dentry
->
d_name
.
hash
);
b
=
d_hash
(
dentry
->
d_parent
,
dentry
->
d_name
.
hash
);
spin_lock_bucket
(
b
);
/*
spin_lock_bucket
(
b
);
* We may not actually need to put DCACHE_UNHASHED
__hlist_bl_del
(
&
dentry
->
d_hash
);
* manipulations under the hash lock, but follow
dentry
->
d_hash
.
pprev
=
NULL
;
* the principle of least surprise.
spin_unlock_bucket
(
b
);
*/
dentry
->
d_flags
|=
DCACHE_UNHASHED
;
dentry_rcuwalk_barrier
(
dentry
);
hlist_bl_del_rcu
(
&
dentry
->
d_hash
);
spin_unlock_bucket
(
b
);
dentry_rcuwalk_barrier
(
dentry
);
}
}
}
}
}
EXPORT_SYMBOL
(
__d_drop
);
EXPORT_SYMBOL
(
__d_drop
);
...
@@ -1301,7 +1292,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
...
@@ -1301,7 +1292,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
dname
[
name
->
len
]
=
0
;
dname
[
name
->
len
]
=
0
;
dentry
->
d_count
=
1
;
dentry
->
d_count
=
1
;
dentry
->
d_flags
=
DCACHE_UNHASHED
;
dentry
->
d_flags
=
0
;
spin_lock_init
(
&
dentry
->
d_lock
);
spin_lock_init
(
&
dentry
->
d_lock
);
seqcount_init
(
&
dentry
->
d_seq
);
seqcount_init
(
&
dentry
->
d_seq
);
dentry
->
d_inode
=
NULL
;
dentry
->
d_inode
=
NULL
;
...
@@ -1603,10 +1594,9 @@ struct dentry *d_obtain_alias(struct inode *inode)
...
@@ -1603,10 +1594,9 @@ struct dentry *d_obtain_alias(struct inode *inode)
tmp
->
d_inode
=
inode
;
tmp
->
d_inode
=
inode
;
tmp
->
d_flags
|=
DCACHE_DISCONNECTED
;
tmp
->
d_flags
|=
DCACHE_DISCONNECTED
;
list_add
(
&
tmp
->
d_alias
,
&
inode
->
i_dentry
);
list_add
(
&
tmp
->
d_alias
,
&
inode
->
i_dentry
);
bit_spin_lock
(
0
,
(
unsigned
long
*
)
&
tmp
->
d_sb
->
s_anon
.
first
);
spin_lock_bucket
(
&
tmp
->
d_sb
->
s_anon
);
tmp
->
d_flags
&=
~
DCACHE_UNHASHED
;
hlist_bl_add_head
(
&
tmp
->
d_hash
,
&
tmp
->
d_sb
->
s_anon
);
hlist_bl_add_head
(
&
tmp
->
d_hash
,
&
tmp
->
d_sb
->
s_anon
);
__bit_spin_unlock
(
0
,
(
unsigned
long
*
)
&
tmp
->
d_sb
->
s_anon
.
first
);
spin_unlock_bucket
(
&
tmp
->
d_sb
->
s_anon
);
spin_unlock
(
&
tmp
->
d_lock
);
spin_unlock
(
&
tmp
->
d_lock
);
spin_unlock
(
&
inode
->
i_lock
);
spin_unlock
(
&
inode
->
i_lock
);
security_d_instantiate
(
tmp
,
inode
);
security_d_instantiate
(
tmp
,
inode
);
...
@@ -2087,7 +2077,7 @@ static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b)
...
@@ -2087,7 +2077,7 @@ static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b)
{
{
BUG_ON
(
!
d_unhashed
(
entry
));
BUG_ON
(
!
d_unhashed
(
entry
));
spin_lock_bucket
(
b
);
spin_lock_bucket
(
b
);
entry
->
d_flags
&=
~
DCACHE_UNHASHED
;
entry
->
d_flags
|=
DCACHE_RCUACCESS
;
hlist_bl_add_head_rcu
(
&
entry
->
d_hash
,
b
);
hlist_bl_add_head_rcu
(
&
entry
->
d_hash
,
b
);
spin_unlock_bucket
(
b
);
spin_unlock_bucket
(
b
);
}
}
...
...
include/linux/dcache.h
浏览文件 @
5dd12af0
...
@@ -197,7 +197,7 @@ struct dentry_operations {
...
@@ -197,7 +197,7 @@ struct dentry_operations {
* typically using d_splice_alias. */
* typically using d_splice_alias. */
#define DCACHE_REFERENCED 0x0008
/* Recently used, don't discard. */
#define DCACHE_REFERENCED 0x0008
/* Recently used, don't discard. */
#define DCACHE_
UNHASHED 0x0010
#define DCACHE_
RCUACCESS 0x0010
/* Entry has ever been RCU-visible */
#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020
#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020
/* Parent inode is watched by inotify */
/* Parent inode is watched by inotify */
...
@@ -384,7 +384,7 @@ extern struct dentry *dget_parent(struct dentry *dentry);
...
@@ -384,7 +384,7 @@ extern struct dentry *dget_parent(struct dentry *dentry);
static
inline
int
d_unhashed
(
struct
dentry
*
dentry
)
static
inline
int
d_unhashed
(
struct
dentry
*
dentry
)
{
{
return
(
dentry
->
d_flags
&
DCACHE_UNHASHED
);
return
hlist_bl_unhashed
(
&
dentry
->
d_hash
);
}
}
static
inline
int
d_unlinked
(
struct
dentry
*
dentry
)
static
inline
int
d_unlinked
(
struct
dentry
*
dentry
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录