Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
1c215028
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看板
提交
1c215028
编写于
8月 29, 2014
作者:
T
Theodore Ts'o
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ext4: convert ext4_bread() to use the ERR_PTR convention
Signed-off-by:
N
Theodore Ts'o
<
tytso@mit.edu
>
上级
10560082
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
34 addition
and
43 deletion
+34
-43
fs/ext4/dir.c
fs/ext4/dir.c
+3
-5
fs/ext4/ext4.h
fs/ext4/ext4.h
+1
-2
fs/ext4/inode.c
fs/ext4/inode.c
+4
-10
fs/ext4/namei.c
fs/ext4/namei.c
+18
-16
fs/ext4/super.c
fs/ext4/super.c
+8
-10
未找到文件。
fs/ext4/dir.c
浏览文件 @
1c215028
...
@@ -151,13 +151,11 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)
...
@@ -151,13 +151,11 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)
&
file
->
f_ra
,
file
,
&
file
->
f_ra
,
file
,
index
,
1
);
index
,
1
);
file
->
f_ra
.
prev_pos
=
(
loff_t
)
index
<<
PAGE_CACHE_SHIFT
;
file
->
f_ra
.
prev_pos
=
(
loff_t
)
index
<<
PAGE_CACHE_SHIFT
;
bh
=
ext4_bread
(
NULL
,
inode
,
map
.
m_lblk
,
0
,
&
err
);
bh
=
ext4_bread
(
NULL
,
inode
,
map
.
m_lblk
,
0
);
if
(
IS_ERR
(
bh
))
return
PTR_ERR
(
bh
);
}
}
/*
* We ignore I/O errors on directories so users have a chance
* of recovering data when there's a bad sector
*/
if
(
!
bh
)
{
if
(
!
bh
)
{
if
(
!
dir_has_error
)
{
if
(
!
dir_has_error
)
{
EXT4_ERROR_FILE
(
file
,
0
,
EXT4_ERROR_FILE
(
file
,
0
,
...
...
fs/ext4/ext4.h
浏览文件 @
1c215028
...
@@ -2087,8 +2087,7 @@ extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
...
@@ -2087,8 +2087,7 @@ extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
/* inode.c */
/* inode.c */
struct
buffer_head
*
ext4_getblk
(
handle_t
*
,
struct
inode
*
,
ext4_lblk_t
,
int
);
struct
buffer_head
*
ext4_getblk
(
handle_t
*
,
struct
inode
*
,
ext4_lblk_t
,
int
);
struct
buffer_head
*
ext4_bread
(
handle_t
*
,
struct
inode
*
,
struct
buffer_head
*
ext4_bread
(
handle_t
*
,
struct
inode
*
,
ext4_lblk_t
,
int
);
ext4_lblk_t
,
int
,
int
*
);
int
ext4_get_block_write
(
struct
inode
*
inode
,
sector_t
iblock
,
int
ext4_get_block_write
(
struct
inode
*
inode
,
sector_t
iblock
,
struct
buffer_head
*
bh_result
,
int
create
);
struct
buffer_head
*
bh_result
,
int
create
);
int
ext4_get_block
(
struct
inode
*
inode
,
sector_t
iblock
,
int
ext4_get_block
(
struct
inode
*
inode
,
sector_t
iblock
,
...
...
fs/ext4/inode.c
浏览文件 @
1c215028
...
@@ -791,27 +791,21 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
...
@@ -791,27 +791,21 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
}
}
struct
buffer_head
*
ext4_bread
(
handle_t
*
handle
,
struct
inode
*
inode
,
struct
buffer_head
*
ext4_bread
(
handle_t
*
handle
,
struct
inode
*
inode
,
ext4_lblk_t
block
,
int
create
,
int
*
err
)
ext4_lblk_t
block
,
int
create
)
{
{
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
*
err
=
0
;
bh
=
ext4_getblk
(
handle
,
inode
,
block
,
create
);
bh
=
ext4_getblk
(
handle
,
inode
,
block
,
create
);
if
(
IS_ERR
(
bh
))
{
if
(
IS_ERR
(
bh
))
*
err
=
PTR_ERR
(
bh
);
return
NULL
;
}
if
(
!
bh
)
return
bh
;
return
bh
;
if
(
buffer_uptodate
(
bh
))
if
(
!
bh
||
buffer_uptodate
(
bh
))
return
bh
;
return
bh
;
ll_rw_block
(
READ
|
REQ_META
|
REQ_PRIO
,
1
,
&
bh
);
ll_rw_block
(
READ
|
REQ_META
|
REQ_PRIO
,
1
,
&
bh
);
wait_on_buffer
(
bh
);
wait_on_buffer
(
bh
);
if
(
buffer_uptodate
(
bh
))
if
(
buffer_uptodate
(
bh
))
return
bh
;
return
bh
;
put_bh
(
bh
);
put_bh
(
bh
);
*
err
=
-
EIO
;
return
ERR_PTR
(
-
EIO
);
return
NULL
;
}
}
int
ext4_walk_page_buffers
(
handle_t
*
handle
,
int
ext4_walk_page_buffers
(
handle_t
*
handle
,
...
...
fs/ext4/namei.c
浏览文件 @
1c215028
...
@@ -53,7 +53,7 @@ static struct buffer_head *ext4_append(handle_t *handle,
...
@@ -53,7 +53,7 @@ static struct buffer_head *ext4_append(handle_t *handle,
ext4_lblk_t
*
block
)
ext4_lblk_t
*
block
)
{
{
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
int
err
=
0
;
int
err
;
if
(
unlikely
(
EXT4_SB
(
inode
->
i_sb
)
->
s_max_dir_size_kb
&&
if
(
unlikely
(
EXT4_SB
(
inode
->
i_sb
)
->
s_max_dir_size_kb
&&
((
inode
->
i_size
>>
10
)
>=
((
inode
->
i_size
>>
10
)
>=
...
@@ -62,9 +62,9 @@ static struct buffer_head *ext4_append(handle_t *handle,
...
@@ -62,9 +62,9 @@ static struct buffer_head *ext4_append(handle_t *handle,
*
block
=
inode
->
i_size
>>
inode
->
i_sb
->
s_blocksize_bits
;
*
block
=
inode
->
i_size
>>
inode
->
i_sb
->
s_blocksize_bits
;
bh
=
ext4_bread
(
handle
,
inode
,
*
block
,
1
,
&
err
);
bh
=
ext4_bread
(
handle
,
inode
,
*
block
,
1
);
if
(
!
bh
)
if
(
IS_ERR
(
bh
)
)
return
ERR_PTR
(
err
)
;
return
bh
;
inode
->
i_size
+=
inode
->
i_sb
->
s_blocksize
;
inode
->
i_size
+=
inode
->
i_sb
->
s_blocksize
;
EXT4_I
(
inode
)
->
i_disksize
=
inode
->
i_size
;
EXT4_I
(
inode
)
->
i_disksize
=
inode
->
i_size
;
BUFFER_TRACE
(
bh
,
"get_write_access"
);
BUFFER_TRACE
(
bh
,
"get_write_access"
);
...
@@ -94,20 +94,20 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
...
@@ -94,20 +94,20 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
{
{
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
struct
ext4_dir_entry
*
dirent
;
struct
ext4_dir_entry
*
dirent
;
int
err
=
0
,
is_dx_block
=
0
;
int
is_dx_block
=
0
;
bh
=
ext4_bread
(
NULL
,
inode
,
block
,
0
,
&
err
);
bh
=
ext4_bread
(
NULL
,
inode
,
block
,
0
);
if
(
!
bh
)
{
if
(
IS_ERR
(
bh
))
{
if
(
err
==
0
)
{
ext4_error_inode
(
inode
,
__func__
,
line
,
block
,
"Directory hole found"
);
return
ERR_PTR
(
-
EIO
);
}
__ext4_warning
(
inode
->
i_sb
,
__func__
,
line
,
__ext4_warning
(
inode
->
i_sb
,
__func__
,
line
,
"error reading directory block "
"error
%ld
reading directory block "
"(ino %lu, block %lu)"
,
inode
->
i_ino
,
"(ino %lu, block %lu)"
,
PTR_ERR
(
bh
),
inode
->
i_ino
,
(
unsigned
long
)
block
);
(
unsigned
long
)
block
);
return
ERR_PTR
(
err
);
return
bh
;
}
if
(
!
bh
)
{
ext4_error_inode
(
inode
,
__func__
,
line
,
block
,
"Directory hole found"
);
return
ERR_PTR
(
-
EIO
);
}
}
dirent
=
(
struct
ext4_dir_entry
*
)
bh
->
b_data
;
dirent
=
(
struct
ext4_dir_entry
*
)
bh
->
b_data
;
/* Determine whether or not we have an index block */
/* Determine whether or not we have an index block */
...
@@ -640,7 +640,9 @@ struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
...
@@ -640,7 +640,9 @@ struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
u32
range
=
i
<
count
-
1
?
(
dx_get_hash
(
entries
+
1
)
-
hash
)
:
~
hash
;
u32
range
=
i
<
count
-
1
?
(
dx_get_hash
(
entries
+
1
)
-
hash
)
:
~
hash
;
struct
stats
stats
;
struct
stats
stats
;
printk
(
"%s%3u:%03u hash %8x/%8x "
,
levels
?
""
:
" "
,
i
,
block
,
hash
,
range
);
printk
(
"%s%3u:%03u hash %8x/%8x "
,
levels
?
""
:
" "
,
i
,
block
,
hash
,
range
);
if
(
!
(
bh
=
ext4_bread
(
NULL
,
dir
,
block
,
0
,
&
err
)))
continue
;
bh
=
ext4_bread
(
NULL
,
dir
,
block
,
0
);
if
(
!
bh
||
IS_ERR
(
bh
))
continue
;
stats
=
levels
?
stats
=
levels
?
dx_show_entries
(
hinfo
,
dir
,
((
struct
dx_node
*
)
bh
->
b_data
)
->
entries
,
levels
-
1
)
:
dx_show_entries
(
hinfo
,
dir
,
((
struct
dx_node
*
)
bh
->
b_data
)
->
entries
,
levels
-
1
)
:
dx_show_leaf
(
hinfo
,
(
struct
ext4_dir_entry_2
*
)
bh
->
b_data
,
blocksize
,
0
);
dx_show_leaf
(
hinfo
,
(
struct
ext4_dir_entry_2
*
)
bh
->
b_data
,
blocksize
,
0
);
...
...
fs/ext4/super.c
浏览文件 @
1c215028
...
@@ -5305,7 +5305,6 @@ static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
...
@@ -5305,7 +5305,6 @@ static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
{
{
struct
inode
*
inode
=
sb_dqopt
(
sb
)
->
files
[
type
];
struct
inode
*
inode
=
sb_dqopt
(
sb
)
->
files
[
type
];
ext4_lblk_t
blk
=
off
>>
EXT4_BLOCK_SIZE_BITS
(
sb
);
ext4_lblk_t
blk
=
off
>>
EXT4_BLOCK_SIZE_BITS
(
sb
);
int
err
=
0
;
int
offset
=
off
&
(
sb
->
s_blocksize
-
1
);
int
offset
=
off
&
(
sb
->
s_blocksize
-
1
);
int
tocopy
;
int
tocopy
;
size_t
toread
;
size_t
toread
;
...
@@ -5320,9 +5319,9 @@ static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
...
@@ -5320,9 +5319,9 @@ static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
while
(
toread
>
0
)
{
while
(
toread
>
0
)
{
tocopy
=
sb
->
s_blocksize
-
offset
<
toread
?
tocopy
=
sb
->
s_blocksize
-
offset
<
toread
?
sb
->
s_blocksize
-
offset
:
toread
;
sb
->
s_blocksize
-
offset
:
toread
;
bh
=
ext4_bread
(
NULL
,
inode
,
blk
,
0
,
&
err
);
bh
=
ext4_bread
(
NULL
,
inode
,
blk
,
0
);
if
(
err
)
if
(
IS_ERR
(
bh
)
)
return
err
;
return
PTR_ERR
(
bh
)
;
if
(
!
bh
)
/* A hole? */
if
(
!
bh
)
/* A hole? */
memset
(
data
,
0
,
tocopy
);
memset
(
data
,
0
,
tocopy
);
else
else
...
@@ -5343,8 +5342,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
...
@@ -5343,8 +5342,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
{
{
struct
inode
*
inode
=
sb_dqopt
(
sb
)
->
files
[
type
];
struct
inode
*
inode
=
sb_dqopt
(
sb
)
->
files
[
type
];
ext4_lblk_t
blk
=
off
>>
EXT4_BLOCK_SIZE_BITS
(
sb
);
ext4_lblk_t
blk
=
off
>>
EXT4_BLOCK_SIZE_BITS
(
sb
);
int
err
=
0
;
int
err
,
offset
=
off
&
(
sb
->
s_blocksize
-
1
);
int
offset
=
off
&
(
sb
->
s_blocksize
-
1
);
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
handle_t
*
handle
=
journal_current_handle
();
handle_t
*
handle
=
journal_current_handle
();
...
@@ -5365,14 +5363,16 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
...
@@ -5365,14 +5363,16 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
return
-
EIO
;
return
-
EIO
;
}
}
bh
=
ext4_bread
(
handle
,
inode
,
blk
,
1
,
&
err
);
bh
=
ext4_bread
(
handle
,
inode
,
blk
,
1
);
if
(
IS_ERR
(
bh
))
return
PTR_ERR
(
bh
);
if
(
!
bh
)
if
(
!
bh
)
goto
out
;
goto
out
;
BUFFER_TRACE
(
bh
,
"get write access"
);
BUFFER_TRACE
(
bh
,
"get write access"
);
err
=
ext4_journal_get_write_access
(
handle
,
bh
);
err
=
ext4_journal_get_write_access
(
handle
,
bh
);
if
(
err
)
{
if
(
err
)
{
brelse
(
bh
);
brelse
(
bh
);
goto
out
;
return
err
;
}
}
lock_buffer
(
bh
);
lock_buffer
(
bh
);
memcpy
(
bh
->
b_data
+
offset
,
data
,
len
);
memcpy
(
bh
->
b_data
+
offset
,
data
,
len
);
...
@@ -5381,8 +5381,6 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
...
@@ -5381,8 +5381,6 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
err
=
ext4_handle_dirty_metadata
(
handle
,
NULL
,
bh
);
err
=
ext4_handle_dirty_metadata
(
handle
,
NULL
,
bh
);
brelse
(
bh
);
brelse
(
bh
);
out:
out:
if
(
err
)
return
err
;
if
(
inode
->
i_size
<
off
+
len
)
{
if
(
inode
->
i_size
<
off
+
len
)
{
i_size_write
(
inode
,
off
+
len
);
i_size_write
(
inode
,
off
+
len
);
EXT4_I
(
inode
)
->
i_disksize
=
inode
->
i_size
;
EXT4_I
(
inode
)
->
i_disksize
=
inode
->
i_size
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录