Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
8d7be552
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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看板
提交
8d7be552
编写于
5月 10, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
5月 10, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: fix check_node and check_leaf to use less cpu
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
e37c9e69
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
21 deletion
+29
-21
fs/btrfs/ctree.c
fs/btrfs/ctree.c
+26
-18
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+3
-3
未找到文件。
fs/btrfs/ctree.c
浏览文件 @
8d7be552
...
...
@@ -130,15 +130,17 @@ static int comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2)
static
int
check_node
(
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
int
level
)
{
int
i
;
struct
btrfs_node
*
parent
=
NULL
;
struct
btrfs_node
*
node
=
btrfs_buffer_node
(
path
->
nodes
[
level
]);
int
parent_slot
;
int
slot
;
struct
btrfs_key
cpukey
;
u32
nritems
=
btrfs_header_nritems
(
&
node
->
header
);
if
(
path
->
nodes
[
level
+
1
])
parent
=
btrfs_buffer_node
(
path
->
nodes
[
level
+
1
]);
parent_slot
=
path
->
slots
[
level
+
1
];
slot
=
path
->
slots
[
level
];
BUG_ON
(
nritems
==
0
);
if
(
parent
)
{
struct
btrfs_disk_key
*
parent_key
;
...
...
@@ -149,10 +151,13 @@ static int check_node(struct btrfs_root *root, struct btrfs_path *path,
btrfs_header_blocknr
(
&
node
->
header
));
}
BUG_ON
(
nritems
>
BTRFS_NODEPTRS_PER_BLOCK
(
root
));
for
(
i
=
0
;
nritems
>
1
&&
i
<
nritems
-
2
;
i
++
)
{
struct
btrfs_key
cpukey
;
btrfs_disk_key_to_cpu
(
&
cpukey
,
&
node
->
ptrs
[
i
+
1
].
key
);
BUG_ON
(
comp_keys
(
&
node
->
ptrs
[
i
].
key
,
&
cpukey
)
>=
0
);
if
(
slot
!=
0
)
{
btrfs_disk_key_to_cpu
(
&
cpukey
,
&
node
->
ptrs
[
slot
-
1
].
key
);
BUG_ON
(
comp_keys
(
&
node
->
ptrs
[
slot
].
key
,
&
cpukey
)
<=
0
);
}
if
(
slot
<
nritems
-
1
)
{
btrfs_disk_key_to_cpu
(
&
cpukey
,
&
node
->
ptrs
[
slot
+
1
].
key
);
BUG_ON
(
comp_keys
(
&
node
->
ptrs
[
slot
].
key
,
&
cpukey
)
>=
0
);
}
return
0
;
}
...
...
@@ -160,10 +165,12 @@ static int check_node(struct btrfs_root *root, struct btrfs_path *path,
static
int
check_leaf
(
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
int
level
)
{
int
i
;
struct
btrfs_leaf
*
leaf
=
btrfs_buffer_leaf
(
path
->
nodes
[
level
]);
struct
btrfs_node
*
parent
=
NULL
;
int
parent_slot
;
int
slot
=
path
->
slots
[
0
];
struct
btrfs_key
cpukey
;
u32
nritems
=
btrfs_header_nritems
(
&
leaf
->
header
);
if
(
path
->
nodes
[
level
+
1
])
...
...
@@ -182,19 +189,20 @@ static int check_leaf(struct btrfs_root *root, struct btrfs_path *path,
BUG_ON
(
btrfs_node_blockptr
(
parent
,
parent_slot
)
!=
btrfs_header_blocknr
(
&
leaf
->
header
));
}
for
(
i
=
0
;
nritems
>
1
&&
i
<
nritems
-
2
;
i
++
)
{
struct
btrfs_key
cpukey
;
btrfs_disk_key_to_cpu
(
&
cpukey
,
&
leaf
->
items
[
i
+
1
].
key
);
BUG_ON
(
comp_keys
(
&
leaf
->
items
[
i
].
key
,
&
cpukey
)
>=
0
);
BUG_ON
(
btrfs_item_offset
(
leaf
->
items
+
i
)
!=
btrfs_item_end
(
leaf
->
items
+
i
+
1
));
if
(
i
==
0
)
{
BUG_ON
(
btrfs_item_offset
(
leaf
->
items
+
i
)
+
btrfs_item_size
(
leaf
->
items
+
i
)
!=
BTRFS_LEAF_DATA_SIZE
(
root
));
}
if
(
slot
!=
0
)
{
btrfs_disk_key_to_cpu
(
&
cpukey
,
&
leaf
->
items
[
slot
-
1
].
key
);
BUG_ON
(
comp_keys
(
&
leaf
->
items
[
slot
].
key
,
&
cpukey
)
<=
0
);
BUG_ON
(
btrfs_item_offset
(
leaf
->
items
+
slot
-
1
)
!=
btrfs_item_end
(
leaf
->
items
+
slot
));
}
if
(
slot
<
nritems
-
1
)
{
btrfs_disk_key_to_cpu
(
&
cpukey
,
&
leaf
->
items
[
slot
+
1
].
key
);
BUG_ON
(
comp_keys
(
&
leaf
->
items
[
slot
].
key
,
&
cpukey
)
>=
0
);
BUG_ON
(
btrfs_item_offset
(
leaf
->
items
+
slot
)
!=
btrfs_item_end
(
leaf
->
items
+
slot
+
1
));
}
BUG_ON
(
btrfs_item_offset
(
leaf
->
items
)
+
btrfs_item_size
(
leaf
->
items
)
!=
BTRFS_LEAF_DATA_SIZE
(
root
));
return
0
;
}
...
...
fs/btrfs/extent-tree.c
浏览文件 @
8d7be552
...
...
@@ -235,7 +235,7 @@ struct btrfs_block_group_cache *btrfs_find_block_group(struct btrfs_root *root,
hint
->
key
.
offset
-
1
,
BTRFS_BLOCK_GROUP_AVAIL
);
}
last
=
hint
->
key
.
offset
*
2
;
last
=
hint
->
key
.
offset
*
3
;
if
(
hint
->
key
.
objectid
>=
last
)
last
=
max
(
search_start
+
hint
->
key
.
offset
-
1
,
hint
->
key
.
objectid
-
last
);
...
...
@@ -554,8 +554,8 @@ static int update_block_group(struct btrfs_trans_handle *trans,
blocknr
+
i
);
}
}
if
(
old_val
<
(
cache
->
key
.
offset
*
8
)
/
10
&&
old_val
+
num
>=
(
cache
->
key
.
offset
*
8
)
/
10
)
{
if
(
old_val
<
(
cache
->
key
.
offset
*
6
)
/
10
&&
old_val
+
num
>=
(
cache
->
key
.
offset
*
6
)
/
10
)
{
printk
(
"group %Lu now available
\n
"
,
cache
->
key
.
objectid
);
radix_tree_tag_set
(
cache
->
radix
,
cache
->
key
.
objectid
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录