Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FengXiao2002
Linux Imx
提交
97571fd0
L
Linux Imx
项目概览
FengXiao2002
/
Linux Imx
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
Linux Imx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
97571fd0
编写于
2月 24, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
2月 24, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: cleanup & comment
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
00ec4c51
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
1 deletion
+27
-1
fs/btrfs/ctree.c
fs/btrfs/ctree.c
+27
-1
未找到文件。
fs/btrfs/ctree.c
浏览文件 @
97571fd0
...
...
@@ -110,6 +110,10 @@ int generic_bin_search(char *p, int item_size, struct key *key,
return
1
;
}
/*
* simple bin_search frontend that does the right thing for
* leaves vs nodes
*/
int
bin_search
(
struct
node
*
c
,
struct
key
*
key
,
int
*
slot
)
{
if
(
is_leaf
(
c
->
header
.
flags
))
{
...
...
@@ -130,6 +134,10 @@ int bin_search(struct node *c, struct key *key, int *slot)
*
* If the key isn't found, the path points to the slot where it should
* be inserted.
*
* if ins_len > 0, nodes and leaves will be split as we walk down the
* tree. if ins_len < 0, nodes will be merged as we walk down the tree (if
* possible)
*/
int
search_slot
(
struct
ctree_root
*
root
,
struct
key
*
key
,
struct
ctree_path
*
p
,
int
ins_len
)
...
...
@@ -379,6 +387,11 @@ int push_node_right(struct ctree_root *root, struct ctree_path *path, int level)
return
0
;
}
/*
* helper function to insert a new root level in the tree.
* A new node is allocated, and a single item is inserted to
* point to the existing root
*/
static
int
insert_new_root
(
struct
ctree_root
*
root
,
struct
ctree_path
*
path
,
int
level
)
{
...
...
@@ -417,6 +430,7 @@ static int insert_new_root(struct ctree_root *root,
/*
* worker function to insert a single pointer in a node.
* the node should have enough room for the pointer already
*
* slot and level indicate where you want the key to go, and
* blocknr is the block the key points to.
*/
...
...
@@ -449,6 +463,13 @@ int insert_ptr(struct ctree_root *root,
return
0
;
}
/*
* split the node at the specified level in path in two.
* The path is corrected to point to the appropriate node after the split
*
* Before splitting this tries to make some room in the node by pushing
* left and right, if either one works, it returns right away.
*/
int
split_node
(
struct
ctree_root
*
root
,
struct
ctree_path
*
path
,
int
level
)
{
struct
tree_buffer
*
t
;
...
...
@@ -744,10 +765,12 @@ int split_leaf(struct ctree_root *root, struct ctree_path *path, int data_size)
right
=
&
right_buffer
->
leaf
;
memset
(
right
,
0
,
sizeof
(
*
right
));
if
(
mid
<=
slot
)
{
/* FIXME, just alloc a new leaf here */
if
(
leaf_space_used
(
l
,
mid
,
nritems
-
mid
)
+
space_needed
>
LEAF_DATA_SIZE
)
BUG
();
}
else
{
/* FIXME, just alloc a new leaf here */
if
(
leaf_space_used
(
l
,
0
,
mid
+
1
)
+
space_needed
>
LEAF_DATA_SIZE
)
BUG
();
...
...
@@ -983,6 +1006,10 @@ int del_item(struct ctree_root *root, struct ctree_path *path)
return
0
;
}
/*
* walk up the tree as far as required to find the next leaf.
* returns 0 if it found something or -1 if there are no greater leaves.
*/
int
next_leaf
(
struct
ctree_root
*
root
,
struct
ctree_path
*
path
)
{
int
slot
;
...
...
@@ -1044,7 +1071,6 @@ int main() {
root
=
open_ctree
(
"dbfile"
,
&
super
);
srand
(
55
);
for
(
i
=
0
;
i
<
run_size
;
i
++
)
{
buf
=
malloc
(
64
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录