Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
5d0f49c1
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
5d0f49c1
编写于
3月 05, 2016
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
namei: untanlge lookup_fast()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
6c51e513
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
37 addition
and
46 deletion
+37
-46
fs/namei.c
fs/namei.c
+37
-46
未找到文件。
fs/namei.c
浏览文件 @
5d0f49c1
...
...
@@ -1512,32 +1512,29 @@ static struct dentry *__lookup_hash(struct qstr *name,
return
lookup_real
(
base
->
d_inode
,
dentry
,
flags
);
}
/*
* It's more convoluted than I'd like it to be, but... it's still fairly
* small and for now I'd prefer to have fast path as straight as possible.
* It _is_ time-critical.
*/
static
int
lookup_fast
(
struct
nameidata
*
nd
,
struct
path
*
path
,
struct
inode
**
inode
,
unsigned
*
seqp
)
{
struct
vfsmount
*
mnt
=
nd
->
path
.
mnt
;
struct
dentry
*
dentry
,
*
parent
=
nd
->
path
.
dentry
;
int
need_reval
=
1
;
int
status
=
1
;
int
err
;
/*
* Rename seqlock is not required here because in the off chance
* of a false negative due to a concurrent rename,
we're going to
*
do the non-racy lookup, below
.
* of a false negative due to a concurrent rename,
the caller is
*
going to fall back to non-racy lookup
.
*/
if
(
nd
->
flags
&
LOOKUP_RCU
)
{
unsigned
seq
;
bool
negative
;
dentry
=
__d_lookup_rcu
(
parent
,
&
nd
->
last
,
&
seq
);
if
(
!
dentry
)
goto
unlazy
;
if
(
unlikely
(
!
dentry
))
{
if
(
unlazy_walk
(
nd
,
NULL
,
0
))
return
-
ECHILD
;
return
1
;
}
/*
* This sequence count validates that the inode matches
...
...
@@ -1545,7 +1542,7 @@ static int lookup_fast(struct nameidata *nd,
*/
*
inode
=
d_backing_inode
(
dentry
);
negative
=
d_is_negative
(
dentry
);
if
(
read_seqcount_retry
(
&
dentry
->
d_seq
,
seq
))
if
(
unlikely
(
read_seqcount_retry
(
&
dentry
->
d_seq
,
seq
)
))
return
-
ECHILD
;
/*
...
...
@@ -1555,63 +1552,57 @@ static int lookup_fast(struct nameidata *nd,
* The memory barrier in read_seqcount_begin of child is
* enough, we can use __read_seqcount_retry here.
*/
if
(
__read_seqcount_retry
(
&
parent
->
d_seq
,
nd
->
seq
))
if
(
unlikely
(
__read_seqcount_retry
(
&
parent
->
d_seq
,
nd
->
seq
)
))
return
-
ECHILD
;
*
seqp
=
seq
;
if
(
unlikely
(
dentry
->
d_flags
&
DCACHE_OP_REVALIDATE
))
{
if
(
unlikely
(
dentry
->
d_flags
&
DCACHE_OP_REVALIDATE
))
status
=
d_revalidate
(
dentry
,
nd
->
flags
);
if
(
unlikely
(
status
<=
0
))
{
if
(
status
!=
-
ECHILD
)
need_reval
=
0
;
goto
unlazy
;
}
}
if
(
unlazy_walk
(
nd
,
dentry
,
seq
)
)
return
-
ECHILD
;
if
(
status
==
-
ECHILD
)
status
=
d_revalidate
(
dentry
,
nd
->
flags
);
}
else
{
/*
* Note: do negative dentry check after revalidation in
* case that drops it.
*/
if
(
negative
)
if
(
unlikely
(
negative
)
)
return
-
ENOENT
;
path
->
mnt
=
mnt
;
path
->
dentry
=
dentry
;
if
(
likely
(
__follow_mount_rcu
(
nd
,
path
,
inode
,
seqp
)))
return
0
;
unlazy:
if
(
unlazy_walk
(
nd
,
dentry
,
seq
))
return
-
ECHILD
;
}
}
else
{
dentry
=
__d_lookup
(
parent
,
&
nd
->
last
);
}
if
(
unlikely
(
!
dentry
))
goto
need_lookup
;
if
(
unlikely
(
dentry
->
d_flags
&
DCACHE_OP_REVALIDATE
)
&&
need_reval
)
return
1
;
if
(
unlikely
(
dentry
->
d_flags
&
DCACHE_OP_REVALIDATE
))
status
=
d_revalidate
(
dentry
,
nd
->
flags
);
if
(
unlikely
(
status
<=
0
))
{
if
(
status
<
0
)
{
dput
(
dentry
);
return
status
;
}
if
(
unlikely
(
status
<=
0
))
{
if
(
!
status
)
{
d_invalidate
(
dentry
);
status
=
1
;
}
dput
(
dentry
);
goto
need_lookup
;
return
status
;
}
if
(
unlikely
(
d_is_negative
(
dentry
)))
{
dput
(
dentry
);
return
-
ENOENT
;
}
path
->
mnt
=
mnt
;
path
->
dentry
=
dentry
;
err
=
follow_managed
(
path
,
nd
);
if
(
likely
(
!
err
))
*
inode
=
d_backing_inode
(
path
->
dentry
);
return
err
;
need_lookup:
return
1
;
}
/* Fast lookup failed, do it the slow way */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录