Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
537d8f93
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,发现更多精彩内容 >>
提交
537d8f93
编写于
8月 29, 2014
作者:
T
Theodore Ts'o
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ext4: convert ext4_dx_find_entry() to use the ERR_PTR convention
Signed-off-by:
N
Theodore Ts'o
<
tytso@mit.edu
>
上级
d4f03186
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
26 deletion
+20
-26
fs/ext4/namei.c
fs/ext4/namei.c
+20
-26
未找到文件。
fs/ext4/namei.c
浏览文件 @
537d8f93
...
@@ -270,8 +270,7 @@ static int ext4_htree_next_block(struct inode *dir, __u32 hash,
...
@@ -270,8 +270,7 @@ static int ext4_htree_next_block(struct inode *dir, __u32 hash,
__u32
*
start_hash
);
__u32
*
start_hash
);
static
struct
buffer_head
*
ext4_dx_find_entry
(
struct
inode
*
dir
,
static
struct
buffer_head
*
ext4_dx_find_entry
(
struct
inode
*
dir
,
const
struct
qstr
*
d_name
,
const
struct
qstr
*
d_name
,
struct
ext4_dir_entry_2
**
res_dir
,
struct
ext4_dir_entry_2
**
res_dir
);
int
*
err
);
static
int
ext4_dx_add_entry
(
handle_t
*
handle
,
struct
dentry
*
dentry
,
static
int
ext4_dx_add_entry
(
handle_t
*
handle
,
struct
dentry
*
dentry
,
struct
inode
*
inode
);
struct
inode
*
inode
);
...
@@ -1258,17 +1257,13 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
...
@@ -1258,17 +1257,13 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
goto
restart
;
goto
restart
;
}
}
if
(
is_dx
(
dir
))
{
if
(
is_dx
(
dir
))
{
bh
=
ext4_dx_find_entry
(
dir
,
d_name
,
res_dir
,
&
err
);
bh
=
ext4_dx_find_entry
(
dir
,
d_name
,
res_dir
);
/*
/*
* On success, or if the error was file not found,
* On success, or if the error was file not found,
* return. Otherwise, fall back to doing a search the
* return. Otherwise, fall back to doing a search the
* old fashioned way.
* old fashioned way.
*/
*/
if
(
err
==
-
ENOENT
)
if
(
!
IS_ERR
(
bh
)
||
PTR_ERR
(
bh
)
!=
ERR_BAD_DX_DIR
)
return
NULL
;
if
(
err
&&
err
!=
ERR_BAD_DX_DIR
)
return
ERR_PTR
(
err
);
if
(
bh
)
return
bh
;
return
bh
;
dxtrace
(
printk
(
KERN_DEBUG
"ext4_find_entry: dx failed, "
dxtrace
(
printk
(
KERN_DEBUG
"ext4_find_entry: dx failed, "
"falling back
\n
"
));
"falling back
\n
"
));
...
@@ -1366,34 +1361,32 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
...
@@ -1366,34 +1361,32 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
}
}
static
struct
buffer_head
*
ext4_dx_find_entry
(
struct
inode
*
dir
,
const
struct
qstr
*
d_name
,
static
struct
buffer_head
*
ext4_dx_find_entry
(
struct
inode
*
dir
,
const
struct
qstr
*
d_name
,
struct
ext4_dir_entry_2
**
res_dir
,
int
*
err
)
struct
ext4_dir_entry_2
**
res_dir
)
{
{
struct
super_block
*
sb
=
dir
->
i_sb
;
struct
super_block
*
sb
=
dir
->
i_sb
;
struct
dx_hash_info
hinfo
;
struct
dx_hash_info
hinfo
;
struct
dx_frame
frames
[
2
],
*
frame
;
struct
dx_frame
frames
[
2
],
*
frame
;
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
ext4_lblk_t
block
;
ext4_lblk_t
block
;
int
retval
;
int
err
=
0
,
retval
;
if
(
!
(
frame
=
dx_probe
(
d_name
,
dir
,
&
hinfo
,
frames
,
err
)))
frame
=
dx_probe
(
d_name
,
dir
,
&
hinfo
,
frames
,
&
err
);
return
NULL
;
if
(
err
)
return
ERR_PTR
(
err
);
do
{
do
{
block
=
dx_get_block
(
frame
->
at
);
block
=
dx_get_block
(
frame
->
at
);
bh
=
ext4_read_dirblock
(
dir
,
block
,
DIRENT
);
bh
=
ext4_read_dirblock
(
dir
,
block
,
DIRENT
);
if
(
IS_ERR
(
bh
))
{
if
(
IS_ERR
(
bh
))
*
err
=
PTR_ERR
(
bh
);
goto
errout
;
goto
errout
;
}
retval
=
search_dirblock
(
bh
,
dir
,
d_name
,
retval
=
search_dirblock
(
bh
,
dir
,
d_name
,
block
<<
EXT4_BLOCK_SIZE_BITS
(
sb
),
block
<<
EXT4_BLOCK_SIZE_BITS
(
sb
),
res_dir
);
res_dir
);
if
(
retval
==
1
)
{
/* Success! */
if
(
retval
==
1
)
dx_release
(
frames
);
goto
success
;
return
bh
;
}
brelse
(
bh
);
brelse
(
bh
);
if
(
retval
==
-
1
)
{
if
(
retval
==
-
1
)
{
*
err
=
ERR_BAD_DX_DIR
;
bh
=
ERR_PTR
(
ERR_BAD_DX_DIR
)
;
goto
errout
;
goto
errout
;
}
}
...
@@ -1402,18 +1395,19 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, const struct q
...
@@ -1402,18 +1395,19 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, const struct q
frames
,
NULL
);
frames
,
NULL
);
if
(
retval
<
0
)
{
if
(
retval
<
0
)
{
ext4_warning
(
sb
,
ext4_warning
(
sb
,
"error reading index page in directory #%lu"
,
"error
%d
reading index page in directory #%lu"
,
dir
->
i_ino
);
retval
,
dir
->
i_ino
);
*
err
=
retval
;
bh
=
ERR_PTR
(
retval
)
;
goto
errout
;
goto
errout
;
}
}
}
while
(
retval
==
1
);
}
while
(
retval
==
1
);
*
err
=
-
ENOENT
;
bh
=
NULL
;
errout:
errout:
dxtrace
(
printk
(
KERN_DEBUG
"%s not found
\n
"
,
d_name
->
name
));
dxtrace
(
printk
(
KERN_DEBUG
"%s not found
\n
"
,
d_name
->
name
));
dx_release
(
frames
);
success:
return
NULL
;
dx_release
(
frames
);
return
bh
;
}
}
static
struct
dentry
*
ext4_lookup
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
unsigned
int
flags
)
static
struct
dentry
*
ext4_lookup
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
unsigned
int
flags
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录