Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
10560082
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
10560082
编写于
8月 29, 2014
作者:
T
Theodore Ts'o
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ext4: convert ext4_getblk() to use the ERR_PTR convention
Signed-off-by:
N
Theodore Ts'o
<
tytso@mit.edu
>
上级
537d8f93
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
33 deletion
+30
-33
fs/ext4/ext4.h
fs/ext4/ext4.h
+1
-2
fs/ext4/inode.c
fs/ext4/inode.c
+25
-26
fs/ext4/namei.c
fs/ext4/namei.c
+4
-5
未找到文件。
fs/ext4/ext4.h
浏览文件 @
10560082
...
...
@@ -2086,8 +2086,7 @@ extern int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
extern
int
ext4_trim_fs
(
struct
super_block
*
,
struct
fstrim_range
*
);
/* inode.c */
struct
buffer_head
*
ext4_getblk
(
handle_t
*
,
struct
inode
*
,
ext4_lblk_t
,
int
,
int
*
);
struct
buffer_head
*
ext4_getblk
(
handle_t
*
,
struct
inode
*
,
ext4_lblk_t
,
int
);
struct
buffer_head
*
ext4_bread
(
handle_t
*
,
struct
inode
*
,
ext4_lblk_t
,
int
,
int
*
);
int
ext4_get_block_write
(
struct
inode
*
inode
,
sector_t
iblock
,
...
...
fs/ext4/inode.c
浏览文件 @
10560082
...
...
@@ -734,11 +734,11 @@ int ext4_get_block(struct inode *inode, sector_t iblock,
* `handle' can be NULL if create is zero
*/
struct
buffer_head
*
ext4_getblk
(
handle_t
*
handle
,
struct
inode
*
inode
,
ext4_lblk_t
block
,
int
create
,
int
*
errp
)
ext4_lblk_t
block
,
int
create
)
{
struct
ext4_map_blocks
map
;
struct
buffer_head
*
bh
;
int
fatal
=
0
,
err
;
int
err
;
J_ASSERT
(
handle
!=
NULL
||
create
==
0
);
...
...
@@ -747,21 +747,14 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
err
=
ext4_map_blocks
(
handle
,
inode
,
&
map
,
create
?
EXT4_GET_BLOCKS_CREATE
:
0
);
/* ensure we send some value back into *errp */
*
errp
=
0
;
if
(
create
&&
err
==
0
)
err
=
-
ENOSPC
;
/* should never happen */
if
(
err
==
0
)
return
create
?
ERR_PTR
(
-
ENOSPC
)
:
NULL
;
if
(
err
<
0
)
*
errp
=
err
;
if
(
err
<=
0
)
return
NULL
;
return
ERR_PTR
(
err
);
bh
=
sb_getblk
(
inode
->
i_sb
,
map
.
m_pblk
);
if
(
unlikely
(
!
bh
))
{
*
errp
=
-
ENOMEM
;
return
NULL
;
}
if
(
unlikely
(
!
bh
))
return
ERR_PTR
(
-
ENOMEM
);
if
(
map
.
m_flags
&
EXT4_MAP_NEW
)
{
J_ASSERT
(
create
!=
0
);
J_ASSERT
(
handle
!=
NULL
);
...
...
@@ -775,25 +768,26 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
*/
lock_buffer
(
bh
);
BUFFER_TRACE
(
bh
,
"call get_create_access"
);
fatal
=
ext4_journal_get_create_access
(
handle
,
bh
);
if
(
!
fatal
&&
!
buffer_uptodate
(
bh
))
{
err
=
ext4_journal_get_create_access
(
handle
,
bh
);
if
(
unlikely
(
err
))
{
unlock_buffer
(
bh
);
goto
errout
;
}
if
(
!
buffer_uptodate
(
bh
))
{
memset
(
bh
->
b_data
,
0
,
inode
->
i_sb
->
s_blocksize
);
set_buffer_uptodate
(
bh
);
}
unlock_buffer
(
bh
);
BUFFER_TRACE
(
bh
,
"call ext4_handle_dirty_metadata"
);
err
=
ext4_handle_dirty_metadata
(
handle
,
inode
,
bh
);
if
(
!
fatal
)
fatal
=
err
;
}
else
{
if
(
unlikely
(
err
)
)
goto
errout
;
}
else
BUFFER_TRACE
(
bh
,
"not a new buffer"
);
}
if
(
fatal
)
{
*
errp
=
fatal
;
brelse
(
bh
);
bh
=
NULL
;
}
return
bh
;
errout:
brelse
(
bh
);
return
ERR_PTR
(
err
);
}
struct
buffer_head
*
ext4_bread
(
handle_t
*
handle
,
struct
inode
*
inode
,
...
...
@@ -801,7 +795,12 @@ struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
{
struct
buffer_head
*
bh
;
bh
=
ext4_getblk
(
handle
,
inode
,
block
,
create
,
err
);
*
err
=
0
;
bh
=
ext4_getblk
(
handle
,
inode
,
block
,
create
);
if
(
IS_ERR
(
bh
))
{
*
err
=
PTR_ERR
(
bh
);
return
NULL
;
}
if
(
!
bh
)
return
bh
;
if
(
buffer_uptodate
(
bh
))
...
...
fs/ext4/namei.c
浏览文件 @
10560082
...
...
@@ -1226,8 +1226,7 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
buffer */
int
num
=
0
;
ext4_lblk_t
nblocks
;
int
i
,
err
=
0
;
int
namelen
;
int
i
,
namelen
;
*
res_dir
=
NULL
;
sb
=
dir
->
i_sb
;
...
...
@@ -1293,10 +1292,10 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
break
;
}
num
++
;
bh
=
ext4_getblk
(
NULL
,
dir
,
b
++
,
0
,
&
err
);
if
(
unlikely
(
err
))
{
bh
=
ext4_getblk
(
NULL
,
dir
,
b
++
,
0
);
if
(
unlikely
(
IS_ERR
(
bh
)
))
{
if
(
ra_max
==
0
)
return
ERR_PTR
(
err
)
;
return
bh
;
break
;
}
bh_use
[
ra_max
]
=
bh
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录