Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
7f5c1516
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
7
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看板
提交
7f5c1516
编写于
3月 23, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
3月 23, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add generation number to btrfs_header, readdir fixes, hash collision fixes
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
df2ce34c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
14 deletion
+32
-14
fs/btrfs/ctree.c
fs/btrfs/ctree.c
+7
-1
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+13
-1
fs/btrfs/dir-item.c
fs/btrfs/dir-item.c
+2
-2
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+1
-5
fs/btrfs/super.c
fs/btrfs/super.c
+9
-5
未找到文件。
fs/btrfs/ctree.c
浏览文件 @
7f5c1516
#include <linux/module.h>
#include "ctree.h"
#include "disk-io.h"
#include "transaction.h"
static
int
split_node
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
int
level
);
...
...
@@ -39,7 +40,8 @@ static int btrfs_cow_block(struct btrfs_trans_handle *trans, struct btrfs_root
struct
buffer_head
*
cow
;
struct
btrfs_node
*
cow_node
;
if
(
buffer_dirty
(
buf
))
{
if
(
btrfs_header_generation
(
btrfs_buffer_header
(
buf
))
==
trans
->
transid
)
{
*
cow_ret
=
buf
;
return
0
;
}
...
...
@@ -47,6 +49,7 @@ static int btrfs_cow_block(struct btrfs_trans_handle *trans, struct btrfs_root
cow_node
=
btrfs_buffer_node
(
cow
);
memcpy
(
cow_node
,
btrfs_buffer_node
(
buf
),
root
->
blocksize
);
btrfs_set_header_blocknr
(
&
cow_node
->
header
,
cow
->
b_blocknr
);
btrfs_set_header_generation
(
&
cow_node
->
header
,
trans
->
transid
);
*
cow_ret
=
cow
;
mark_buffer_dirty
(
cow
);
btrfs_inc_ref
(
trans
,
root
,
buf
);
...
...
@@ -661,6 +664,7 @@ static int insert_new_root(struct btrfs_trans_handle *trans, struct btrfs_root
btrfs_set_header_nritems
(
&
c
->
header
,
1
);
btrfs_set_header_level
(
&
c
->
header
,
level
);
btrfs_set_header_blocknr
(
&
c
->
header
,
t
->
b_blocknr
);
btrfs_set_header_generation
(
&
c
->
header
,
trans
->
transid
);
btrfs_set_header_parentid
(
&
c
->
header
,
btrfs_header_parentid
(
btrfs_buffer_header
(
root
->
node
)));
lower
=
btrfs_buffer_node
(
path
->
nodes
[
level
-
1
]);
...
...
@@ -750,6 +754,7 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
split
=
btrfs_buffer_node
(
split_buffer
);
btrfs_set_header_flags
(
&
split
->
header
,
btrfs_header_flags
(
&
c
->
header
));
btrfs_set_header_blocknr
(
&
split
->
header
,
split_buffer
->
b_blocknr
);
btrfs_set_header_generation
(
&
split
->
header
,
trans
->
transid
);
btrfs_set_header_parentid
(
&
split
->
header
,
btrfs_header_parentid
(
btrfs_buffer_header
(
root
->
node
)));
mid
=
(
c_nritems
+
1
)
/
2
;
...
...
@@ -1096,6 +1101,7 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root
}
btrfs_set_header_nritems
(
&
right
->
header
,
nritems
-
mid
);
btrfs_set_header_blocknr
(
&
right
->
header
,
right_buffer
->
b_blocknr
);
btrfs_set_header_generation
(
&
right
->
header
,
trans
->
transid
);
btrfs_set_header_level
(
&
right
->
header
,
0
);
btrfs_set_header_parentid
(
&
right
->
header
,
btrfs_header_parentid
(
btrfs_buffer_header
(
root
->
node
)));
...
...
fs/btrfs/ctree.h
浏览文件 @
7f5c1516
...
...
@@ -52,6 +52,7 @@ struct btrfs_key {
struct
btrfs_header
{
u8
fsid
[
16
];
/* FS specific uuid */
__le64
blocknr
;
/* which block this node is supposed to live in */
__le64
generation
;
__le64
parentid
;
/* objectid of the tree root */
__le32
csum
;
__le32
ham
;
...
...
@@ -600,6 +601,17 @@ static inline void btrfs_set_header_blocknr(struct btrfs_header *h, u64 blocknr)
h
->
blocknr
=
cpu_to_le64
(
blocknr
);
}
static
inline
u64
btrfs_header_generation
(
struct
btrfs_header
*
h
)
{
return
le64_to_cpu
(
h
->
generation
);
}
static
inline
void
btrfs_set_header_generation
(
struct
btrfs_header
*
h
,
u64
val
)
{
h
->
generation
=
cpu_to_le64
(
val
);
}
static
inline
u64
btrfs_header_parentid
(
struct
btrfs_header
*
h
)
{
return
le64_to_cpu
(
h
->
parentid
);
...
...
@@ -839,7 +851,7 @@ int btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
*
root
,
struct
btrfs_path
*
path
,
u64
dir
,
const
char
*
name
,
int
name_len
,
int
mod
);
int
btrfs_match_dir_item_name
(
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
char
*
name
,
int
name_len
);
c
onst
c
har
*
name
,
int
name_len
);
int
btrfs_find_free_objectid
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
fs_root
,
u64
dirid
,
u64
*
objectid
);
...
...
fs/btrfs/dir-item.c
浏览文件 @
7f5c1516
...
...
@@ -60,8 +60,8 @@ int btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
}
int
btrfs_match_dir_item_name
(
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
char
*
name
,
int
name_len
)
struct
btrfs_path
*
path
,
const
char
*
name
,
int
name_len
)
{
struct
btrfs_dir_item
*
dir_item
;
char
*
name_ptr
;
...
...
fs/btrfs/disk-io.c
浏览文件 @
7f5c1516
...
...
@@ -11,11 +11,7 @@ static int check_tree_block(struct btrfs_root *root, struct buffer_head *buf)
BUG
();
if
(
root
->
node
&&
btrfs_header_parentid
(
&
node
->
header
)
!=
btrfs_header_parentid
(
btrfs_buffer_header
(
root
->
node
)))
{
printk
(
"block %Lu parentids don't match buf %Lu, root %Lu
\n
"
,
buf
->
b_blocknr
,
btrfs_header_parentid
(
&
node
->
header
),
btrfs_header_parentid
(
btrfs_buffer_header
(
root
->
node
)));
WARN_ON
(
1
);
BUG
();
}
return
0
;
}
...
...
fs/btrfs/super.c
浏览文件 @
7f5c1516
...
...
@@ -199,7 +199,7 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
btrfs_init_path
(
&
path
);
ret
=
btrfs_lookup_dir_item
(
NULL
,
root
,
&
path
,
dir
->
i_ino
,
name
,
namelen
,
0
);
if
(
ret
)
{
if
(
ret
||
!
btrfs_match_dir_item_name
(
root
,
&
path
,
name
,
namelen
)
)
{
*
ino
=
0
;
goto
out
;
}
...
...
@@ -247,7 +247,7 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
int
slot
;
int
advance
;
unsigned
char
d_type
=
DT_UNKNOWN
;
int
over
;
int
over
=
0
;
key
.
objectid
=
inode
->
i_ino
;
key
.
flags
=
0
;
...
...
@@ -258,7 +258,7 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
ret
<
0
)
{
goto
err
;
}
advance
=
filp
->
f_pos
>
0
&&
ret
!=
0
;
advance
=
0
;
while
(
1
)
{
leaf
=
btrfs_buffer_leaf
(
path
.
nodes
[
0
]);
nritems
=
btrfs_header_nritems
(
&
leaf
->
header
);
...
...
@@ -282,13 +282,17 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
break
;
if
(
btrfs_disk_key_type
(
&
item
->
key
)
!=
BTRFS_DIR_ITEM_KEY
)
continue
;
if
(
btrfs_disk_key_offset
(
&
item
->
key
)
<
filp
->
f_pos
)
continue
;
di
=
btrfs_item_ptr
(
leaf
,
slot
,
struct
btrfs_dir_item
);
over
=
filldir
(
dirent
,
(
const
char
*
)(
di
+
1
),
btrfs_dir_name_len
(
di
),
btrfs_disk_key_offset
(
&
item
->
key
),
btrfs_dir_objectid
(
di
),
d_type
);
if
(
over
)
if
(
over
)
{
filp
->
f_pos
=
btrfs_disk_key_offset
(
&
item
->
key
);
break
;
}
filp
->
f_pos
=
btrfs_disk_key_offset
(
&
item
->
key
)
+
1
;
}
ret
=
0
;
...
...
@@ -425,7 +429,6 @@ static int btrfs_add_link(struct btrfs_trans_handle *trans,
dentry
->
d_name
.
name
,
dentry
->
d_name
.
len
,
dentry
->
d_parent
->
d_inode
->
i_ino
,
inode
->
i_ino
,
0
);
BUG_ON
(
ret
);
return
ret
;
}
...
...
@@ -466,6 +469,7 @@ static void btrfs_write_super(struct super_block *sb)
{
sb
->
s_dirt
=
0
;
printk
(
"btrfs write_super!
\n
"
);
filemap_flush
(
sb
->
s_bdev
->
bd_inode
->
i_mapping
);
}
static
int
btrfs_sync_fs
(
struct
super_block
*
sb
,
int
wait
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录