Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
01daf945
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看板
提交
01daf945
编写于
1月 22, 2017
作者:
T
Theodore Ts'o
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ext4: propagate error values from ext4_inline_data_truncate()
Signed-off-by:
N
Theodore Ts'o
<
tytso@mit.edu
>
上级
b907f2d5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
19 deletion
+27
-19
fs/ext4/ext4.h
fs/ext4/ext4.h
+1
-1
fs/ext4/inline.c
fs/ext4/inline.c
+23
-17
fs/ext4/inode.c
fs/ext4/inode.c
+3
-1
未找到文件。
fs/ext4/ext4.h
浏览文件 @
01daf945
...
...
@@ -3023,7 +3023,7 @@ extern int ext4_inline_data_fiemap(struct inode *inode,
extern
int
ext4_try_to_evict_inline_data
(
handle_t
*
handle
,
struct
inode
*
inode
,
int
needed
);
extern
void
ext4_inline_data_truncate
(
struct
inode
*
inode
,
int
*
has_inline
);
extern
int
ext4_inline_data_truncate
(
struct
inode
*
inode
,
int
*
has_inline
);
extern
int
ext4_convert_inline_data
(
struct
inode
*
inode
);
...
...
fs/ext4/inline.c
浏览文件 @
01daf945
...
...
@@ -1896,10 +1896,10 @@ int ext4_try_to_evict_inline_data(handle_t *handle,
return
error
;
}
void
ext4_inline_data_truncate
(
struct
inode
*
inode
,
int
*
has_inline
)
int
ext4_inline_data_truncate
(
struct
inode
*
inode
,
int
*
has_inline
)
{
handle_t
*
handle
;
int
inline_size
,
value_len
,
needed_blocks
,
no_expand
;
int
inline_size
,
value_len
,
needed_blocks
,
no_expand
,
err
=
0
;
size_t
i_size
;
void
*
value
=
NULL
;
struct
ext4_xattr_ibody_find
is
=
{
...
...
@@ -1914,19 +1914,19 @@ void ext4_inline_data_truncate(struct inode *inode, int *has_inline)
needed_blocks
=
ext4_writepage_trans_blocks
(
inode
);
handle
=
ext4_journal_start
(
inode
,
EXT4_HT_INODE
,
needed_blocks
);
if
(
IS_ERR
(
handle
))
return
;
return
PTR_ERR
(
handle
)
;
ext4_write_lock_xattr
(
inode
,
&
no_expand
);
if
(
!
ext4_has_inline_data
(
inode
))
{
*
has_inline
=
0
;
ext4_journal_stop
(
handle
);
return
;
return
0
;
}
if
(
ext4_orphan_add
(
handle
,
inode
)
)
if
(
(
err
=
ext4_orphan_add
(
handle
,
inode
))
!=
0
)
goto
out
;
if
(
ext4_get_inode_loc
(
inode
,
&
is
.
iloc
)
)
if
(
(
err
=
ext4_get_inode_loc
(
inode
,
&
is
.
iloc
))
!=
0
)
goto
out
;
down_write
(
&
EXT4_I
(
inode
)
->
i_data_sem
);
...
...
@@ -1937,24 +1937,29 @@ void ext4_inline_data_truncate(struct inode *inode, int *has_inline)
if
(
i_size
<
inline_size
)
{
/* Clear the content in the xattr space. */
if
(
inline_size
>
EXT4_MIN_INLINE_DATA_SIZE
)
{
if
(
ext4_xattr_ibody_find
(
inode
,
&
i
,
&
is
)
)
if
(
(
err
=
ext4_xattr_ibody_find
(
inode
,
&
i
,
&
is
))
!=
0
)
goto
out_error
;
BUG_ON
(
is
.
s
.
not_found
);
value_len
=
le32_to_cpu
(
is
.
s
.
here
->
e_value_size
);
value
=
kmalloc
(
value_len
,
GFP_NOFS
);
if
(
!
value
)
if
(
!
value
)
{
err
=
-
ENOMEM
;
goto
out_error
;
}
if
(
ext4_xattr_ibody_get
(
inode
,
i
.
name_index
,
i
.
name
,
value
,
value_len
))
err
=
ext4_xattr_ibody_get
(
inode
,
i
.
name_index
,
i
.
name
,
value
,
value_len
);
if
(
err
<=
0
)
goto
out_error
;
i
.
value
=
value
;
i
.
value_len
=
i_size
>
EXT4_MIN_INLINE_DATA_SIZE
?
i_size
-
EXT4_MIN_INLINE_DATA_SIZE
:
0
;
if
(
ext4_xattr_ibody_inline_set
(
handle
,
inode
,
&
i
,
&
is
))
err
=
ext4_xattr_ibody_inline_set
(
handle
,
inode
,
&
i
,
&
is
);
if
(
err
)
goto
out_error
;
}
...
...
@@ -1979,13 +1984,14 @@ void ext4_inline_data_truncate(struct inode *inode, int *has_inline)
if
(
inode
->
i_nlink
)
ext4_orphan_del
(
handle
,
inode
);
inode
->
i_mtime
=
inode
->
i_ctime
=
current_time
(
inode
);
ext4_mark_inode_dirty
(
handle
,
inode
);
if
(
IS_SYNC
(
inode
))
ext4_handle_sync
(
handle
);
if
(
err
==
0
)
{
inode
->
i_mtime
=
inode
->
i_ctime
=
current_time
(
inode
);
err
=
ext4_mark_inode_dirty
(
handle
,
inode
);
if
(
IS_SYNC
(
inode
))
ext4_handle_sync
(
handle
);
}
ext4_journal_stop
(
handle
);
return
;
return
err
;
}
int
ext4_convert_inline_data
(
struct
inode
*
inode
)
...
...
fs/ext4/inode.c
浏览文件 @
01daf945
...
...
@@ -4222,7 +4222,9 @@ int ext4_truncate(struct inode *inode)
if
(
ext4_has_inline_data
(
inode
))
{
int
has_inline
=
1
;
ext4_inline_data_truncate
(
inode
,
&
has_inline
);
err
=
ext4_inline_data_truncate
(
inode
,
&
has_inline
);
if
(
err
)
return
err
;
if
(
has_inline
)
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录