Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
ff79f819
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ff79f819
编写于
10月 15, 2007
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Add back file data checksumming
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
cf786e79
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
26 addition
and
19 deletion
+26
-19
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+1
-0
fs/btrfs/disk-io.h
fs/btrfs/disk-io.h
+2
-0
fs/btrfs/extent_map.c
fs/btrfs/extent_map.c
+3
-0
fs/btrfs/file-item.c
fs/btrfs/file-item.c
+9
-8
fs/btrfs/file.c
fs/btrfs/file.c
+1
-0
fs/btrfs/inode.c
fs/btrfs/inode.c
+10
-11
未找到文件。
fs/btrfs/disk-io.c
浏览文件 @
ff79f819
...
...
@@ -594,6 +594,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
tree_root
->
nodesize
=
nodesize
;
tree_root
->
leafsize
=
leafsize
;
tree_root
->
sectorsize
=
sectorsize
;
sb_set_blocksize
(
sb
,
sectorsize
);
i_size_write
(
fs_info
->
btree_inode
,
btrfs_super_total_bytes
(
disk_super
));
...
...
fs/btrfs/disk-io.h
浏览文件 @
ff79f819
...
...
@@ -58,4 +58,6 @@ int btrfs_buffer_defrag_done(struct extent_buffer *buf);
int
btrfs_clear_buffer_defrag
(
struct
extent_buffer
*
buf
);
int
btrfs_clear_buffer_defrag_done
(
struct
extent_buffer
*
buf
);
int
btrfs_read_buffer
(
struct
extent_buffer
*
buf
);
u32
btrfs_csum_data
(
struct
btrfs_root
*
root
,
char
*
data
,
u32
seed
,
size_t
len
);
void
btrfs_csum_final
(
u32
crc
,
char
*
result
);
#endif
fs/btrfs/extent_map.c
浏览文件 @
ff79f819
...
...
@@ -2031,6 +2031,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_map_tree *tree,
i
=
1
;
index
++
;
page_cache_get
(
page0
);
mark_page_accessed
(
page0
);
set_page_extent_mapped
(
page0
);
set_page_private
(
page0
,
EXTENT_PAGE_PRIVATE_FIRST_PAGE
|
len
<<
2
);
...
...
@@ -2049,6 +2050,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_map_tree *tree,
goto
fail
;
}
set_page_extent_mapped
(
p
);
mark_page_accessed
(
p
);
if
(
i
==
0
)
{
eb
->
first_page
=
p
;
set_page_private
(
p
,
EXTENT_PAGE_PRIVATE_FIRST_PAGE
|
...
...
@@ -2099,6 +2101,7 @@ struct extent_buffer *find_extent_buffer(struct extent_map_tree *tree,
goto
fail
;
}
set_page_extent_mapped
(
p
);
mark_page_accessed
(
p
);
if
(
i
==
0
)
{
eb
->
first_page
=
p
;
...
...
fs/btrfs/file-item.c
浏览文件 @
ff79f819
...
...
@@ -136,27 +136,27 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans,
u64
objectid
,
u64
offset
,
char
*
data
,
size_t
len
)
{
return
0
;
#if 0
int
ret
;
struct
btrfs_key
file_key
;
struct
btrfs_key
found_key
;
struct
btrfs_path
*
path
;
struct
btrfs_csum_item
*
item
;
struct extent_buffer *leaf;
struct
extent_buffer
*
leaf
=
NULL
;
u64
csum_offset
;
u32
csum_result
=
~
(
u32
)
0
;
path
=
btrfs_alloc_path
();
BUG_ON
(
!
path
);
file_key
.
objectid
=
objectid
;
file_key
.
offset
=
offset
;
file_key.flags = 0;
btrfs_set_key_type
(
&
file_key
,
BTRFS_CSUM_ITEM_KEY
);
item
=
btrfs_lookup_csum
(
trans
,
root
,
path
,
objectid
,
offset
,
1
);
if (!IS_ERR(item))
if
(
!
IS_ERR
(
item
))
{
leaf
=
path
->
nodes
[
0
];
goto
found
;
}
ret
=
PTR_ERR
(
item
);
if
(
ret
==
-
EFBIG
)
{
u32
item_size
;
...
...
@@ -226,14 +226,15 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans,
item
=
(
struct
btrfs_csum_item
*
)((
unsigned
char
*
)
item
+
csum_offset
*
BTRFS_CRC32_SIZE
);
found:
/* FIXME!!!!!!!!!!!! */
ret = btrfs_csum_data(root, data, len, &item->csum);
csum_result
=
btrfs_csum_data
(
root
,
data
,
csum_result
,
len
);
btrfs_csum_final
(
csum_result
,
(
char
*
)
&
csum_result
);
write_extent_buffer
(
leaf
,
&
csum_result
,
(
unsigned
long
)
item
,
BTRFS_CRC32_SIZE
);
btrfs_mark_buffer_dirty
(
path
->
nodes
[
0
]);
fail:
btrfs_release_path
(
root
,
path
);
btrfs_free_path
(
path
);
return
ret
;
#endif
}
int
btrfs_csum_truncate
(
struct
btrfs_trans_handle
*
trans
,
...
...
fs/btrfs/file.c
浏览文件 @
ff79f819
...
...
@@ -289,6 +289,7 @@ static int dirty_and_release_pages(struct btrfs_trans_handle *trans,
*/
inline_size
=
end_pos
;
if
(
isize
>=
BTRFS_MAX_INLINE_DATA_SIZE
(
root
)
||
inline_size
>
16384
||
inline_size
>=
BTRFS_MAX_INLINE_DATA_SIZE
(
root
))
{
u64
last_end
;
...
...
fs/btrfs/inode.c
浏览文件 @
ff79f819
...
...
@@ -135,7 +135,7 @@ int btrfs_readpage_io_hook(struct page *page, u64 start, u64 end)
struct
extent_map_tree
*
em_tree
=
&
BTRFS_I
(
inode
)
->
extent_tree
;
struct
btrfs_csum_item
*
item
;
struct
btrfs_path
*
path
=
NULL
;
u
64
private
;
u
32
csum
;
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
path
=
btrfs_alloc_path
();
...
...
@@ -145,11 +145,12 @@ int btrfs_readpage_io_hook(struct page *page, u64 start, u64 end)
/* a csum that isn't present is a preallocated region. */
if
(
ret
==
-
ENOENT
||
ret
==
-
EFBIG
)
ret
=
0
;
private
=
0
;
csum
=
0
;
goto
out
;
}
memcpy
((
char
*
)
&
private
,
&
item
->
csum
,
BTRFS_CRC32_SIZE
);
set_state_private
(
em_tree
,
start
,
private
);
read_extent_buffer
(
path
->
nodes
[
0
],
&
csum
,
(
unsigned
long
)
item
,
BTRFS_CRC32_SIZE
);
set_state_private
(
em_tree
,
start
,
csum
);
out:
if
(
path
)
btrfs_free_path
(
path
);
...
...
@@ -165,21 +166,19 @@ int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end)
char
*
kaddr
;
u64
private
;
int
ret
;
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
u32
csum
=
~
(
u32
)
0
;
ret
=
get_state_private
(
em_tree
,
start
,
&
private
);
kaddr
=
kmap_atomic
(
page
,
KM_IRQ0
);
if
(
ret
)
{
goto
zeroit
;
}
/*
struct btrfs_root *root = BTRFS_I(inode)->root;
char csum[BTRFS_CRC32_SIZE];
ret = btrfs_csum_data(root, kaddr + offset, end - start + 1, csum);
BUG_ON(ret);
if (memcmp(csum, &private, BTRFS_CRC32_SIZE)) {
csum
=
btrfs_csum_data
(
root
,
kaddr
+
offset
,
csum
,
end
-
start
+
1
);
btrfs_csum_final
(
csum
,
(
char
*
)
&
csum
);
if
(
csum
!=
private
)
{
goto
zeroit
;
}
*/
kunmap_atomic
(
kaddr
,
KM_IRQ0
);
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录