Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
bea495e5
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bea495e5
编写于
1月 24, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Tune readahead during defrag to avoid reading too much at once
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
d1310b2e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
13 deletion
+28
-13
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+28
-13
未找到文件。
fs/btrfs/extent-tree.c
浏览文件 @
bea495e5
...
@@ -1856,27 +1856,44 @@ static int noinline drop_leaf_ref(struct btrfs_trans_handle *trans,
...
@@ -1856,27 +1856,44 @@ static int noinline drop_leaf_ref(struct btrfs_trans_handle *trans,
}
}
static
void
noinline
reada_walk_down
(
struct
btrfs_root
*
root
,
static
void
noinline
reada_walk_down
(
struct
btrfs_root
*
root
,
struct
extent_buffer
*
node
)
struct
extent_buffer
*
node
,
int
slot
)
{
{
int
i
;
u32
nritems
;
u64
bytenr
;
u64
bytenr
;
int
ret
;
u64
last
=
0
;
u32
nritems
;
u32
refs
;
u32
refs
;
int
level
;
u32
blocksize
;
u32
blocksize
;
int
ret
;
int
i
;
int
level
;
int
skipped
=
0
;
nritems
=
btrfs_header_nritems
(
node
);
nritems
=
btrfs_header_nritems
(
node
);
level
=
btrfs_header_level
(
node
);
level
=
btrfs_header_level
(
node
);
for
(
i
=
0
;
i
<
nritems
;
i
++
)
{
if
(
level
)
return
;
for
(
i
=
slot
;
i
<
nritems
&&
skipped
<
32
;
i
++
)
{
bytenr
=
btrfs_node_blockptr
(
node
,
i
);
bytenr
=
btrfs_node_blockptr
(
node
,
i
);
blocksize
=
btrfs_level_size
(
root
,
level
-
1
);
if
(
last
&&
((
bytenr
>
last
&&
bytenr
-
last
>
32
*
1024
)
||
ret
=
lookup_extent_ref
(
NULL
,
root
,
bytenr
,
blocksize
,
&
refs
);
(
last
>
bytenr
&&
last
-
bytenr
>
32
*
1024
)))
{
BUG_ON
(
ret
);
skipped
++
;
if
(
refs
!=
1
)
continue
;
continue
;
}
blocksize
=
btrfs_level_size
(
root
,
level
-
1
);
if
(
i
!=
slot
)
{
ret
=
lookup_extent_ref
(
NULL
,
root
,
bytenr
,
blocksize
,
&
refs
);
BUG_ON
(
ret
);
if
(
refs
!=
1
)
{
skipped
++
;
continue
;
}
}
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
ret
=
readahead_tree_block
(
root
,
bytenr
,
blocksize
);
ret
=
readahead_tree_block
(
root
,
bytenr
,
blocksize
);
last
=
bytenr
+
blocksize
;
cond_resched
();
cond_resched
();
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
if
(
ret
)
if
(
ret
)
...
@@ -1919,9 +1936,6 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
...
@@ -1919,9 +1936,6 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
WARN_ON
(
*
level
>=
BTRFS_MAX_LEVEL
);
WARN_ON
(
*
level
>=
BTRFS_MAX_LEVEL
);
cur
=
path
->
nodes
[
*
level
];
cur
=
path
->
nodes
[
*
level
];
if
(
*
level
>
0
&&
path
->
slots
[
*
level
]
==
0
)
reada_walk_down
(
root
,
cur
);
if
(
btrfs_header_level
(
cur
)
!=
*
level
)
if
(
btrfs_header_level
(
cur
)
!=
*
level
)
WARN_ON
(
1
);
WARN_ON
(
1
);
...
@@ -1951,6 +1965,7 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
...
@@ -1951,6 +1965,7 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
next
=
btrfs_find_tree_block
(
root
,
bytenr
,
blocksize
);
next
=
btrfs_find_tree_block
(
root
,
bytenr
,
blocksize
);
if
(
!
next
||
!
btrfs_buffer_uptodate
(
next
))
{
if
(
!
next
||
!
btrfs_buffer_uptodate
(
next
))
{
free_extent_buffer
(
next
);
free_extent_buffer
(
next
);
reada_walk_down
(
root
,
cur
,
path
->
slots
[
*
level
]);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
next
=
read_tree_block
(
root
,
bytenr
,
blocksize
);
next
=
read_tree_block
(
root
,
bytenr
,
blocksize
);
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录