Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
0579da42
C
clone-Linux
项目概览
gsplhtlxg
/
clone-Linux
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
clone-Linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0579da42
编写于
3月 07, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
3月 07, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Fixup last found extent caching
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
037e6390
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
19 deletion
+24
-19
fs/btrfs/Makefile
fs/btrfs/Makefile
+1
-1
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+1
-0
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+1
-0
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+21
-18
未找到文件。
fs/btrfs/Makefile
浏览文件 @
0579da42
CC
=
gcc
CFLAGS
=
-Wall
CFLAGS
=
-
g
-
Wall
headers
=
radix-tree.h ctree.h disk-io.h kerncompat.h print-tree.h list.h
objects
=
ctree.o disk-io.o radix-tree.o mkfs.o extent-tree.o print-tree.o
...
...
fs/btrfs/ctree.h
浏览文件 @
0579da42
...
...
@@ -54,6 +54,7 @@ struct ctree_root {
struct
tree_buffer
*
commit_root
;
struct
ctree_root
*
extent_root
;
struct
key
current_insert
;
struct
key
last_insert
;
int
fp
;
struct
radix_tree_root
cache_radix
;
struct
radix_tree_root
pinned_radix
;
...
...
fs/btrfs/disk-io.c
浏览文件 @
0579da42
...
...
@@ -186,6 +186,7 @@ static int __setup_root(struct ctree_root *root, struct ctree_root *extent_root,
root
->
commit_root
=
NULL
;
root
->
node
=
read_tree_block
(
root
,
info
->
tree_root
);
memset
(
&
root
->
current_insert
,
0
,
sizeof
(
root
->
current_insert
));
memset
(
&
root
->
last_insert
,
0
,
sizeof
(
root
->
last_insert
));
return
0
;
}
...
...
fs/btrfs/extent-tree.c
浏览文件 @
0579da42
...
...
@@ -102,9 +102,12 @@ int btrfs_finish_extent_commit(struct ctree_root *root)
ARRAY_SIZE
(
gang
));
if
(
!
ret
)
break
;
for
(
i
=
0
;
i
<
ret
;
i
++
)
for
(
i
=
0
;
i
<
ret
;
i
++
)
{
radix_tree_delete
(
&
extent_root
->
pinned_radix
,
gang
[
i
]);
}
}
extent_root
->
last_insert
.
objectid
=
0
;
extent_root
->
last_insert
.
offset
=
0
;
return
0
;
}
...
...
@@ -170,6 +173,9 @@ int __free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks)
radix_tree_preload_end
();
}
ret
=
del_item
(
extent_root
,
&
path
);
if
(
root
!=
extent_root
&&
extent_root
->
last_insert
.
objectid
<
blocknr
)
extent_root
->
last_insert
.
objectid
=
blocknr
;
if
(
ret
)
BUG
();
}
...
...
@@ -261,8 +267,11 @@ static int find_free_extent(struct ctree_root *orig_root, u64 num_blocks,
int
start_found
;
struct
leaf
*
l
;
struct
ctree_root
*
root
=
orig_root
->
extent_root
;
int
total_needed
=
num_blocks
+
MAX_LEVEL
*
3
;
int
total_needed
=
num_blocks
;
total_needed
+=
(
node_level
(
root
->
node
->
node
.
header
.
flags
)
+
1
)
*
3
;
if
(
root
->
last_insert
.
objectid
>
search_start
)
search_start
=
root
->
last_insert
.
objectid
;
check_failed:
init_path
(
&
path
);
ins
->
objectid
=
search_start
;
...
...
@@ -273,6 +282,9 @@ static int find_free_extent(struct ctree_root *orig_root, u64 num_blocks,
if
(
ret
<
0
)
goto
error
;
if
(
path
.
slots
[
0
]
>
0
)
path
.
slots
[
0
]
--
;
while
(
1
)
{
l
=
&
path
.
nodes
[
0
]
->
leaf
;
slot
=
path
.
slots
[
0
];
...
...
@@ -293,31 +305,21 @@ static int find_free_extent(struct ctree_root *orig_root, u64 num_blocks,
ins
->
offset
=
(
u64
)
-
1
;
goto
check_pending
;
}
if
(
slot
==
0
)
{
int
last_slot
=
l
->
header
.
nritems
-
1
;
u64
span
=
l
->
items
[
last_slot
].
key
.
objectid
;
span
-=
l
->
items
[
slot
].
key
.
objectid
;
if
(
span
+
total_needed
>
last_slot
-
slot
)
{
path
.
slots
[
0
]
=
last_slot
+
1
;
key
=
&
l
->
items
[
last_slot
].
key
;
last_block
=
key
->
objectid
+
key
->
offset
;
start_found
=
1
;
continue
;
}
}
key
=
&
l
->
items
[
slot
].
key
;
if
(
key
->
objectid
>=
search_start
)
{
if
(
start_found
)
{
if
(
last_block
<
search_start
)
last_block
=
search_start
;
hole_size
=
key
->
objectid
-
last_block
;
if
(
hole_size
>
total_needed
)
{
ins
->
objectid
=
last_block
;
ins
->
offset
=
hole_size
;
goto
check_pending
;
}
}
else
start_found
=
1
;
last_block
=
key
->
objectid
+
key
->
offset
;
}
}
start_found
=
1
;
last_block
=
key
->
objectid
+
key
->
offset
;
path
.
slots
[
0
]
++
;
}
// FIXME -ENOSPC
...
...
@@ -335,9 +337,10 @@ static int find_free_extent(struct ctree_root *orig_root, u64 num_blocks,
}
}
BUG_ON
(
root
->
current_insert
.
offset
);
root
->
current_insert
.
offset
=
total_needed
;
root
->
current_insert
.
offset
=
total_needed
-
num_blocks
;
root
->
current_insert
.
objectid
=
ins
->
objectid
+
num_blocks
;
root
->
current_insert
.
flags
=
0
;
root
->
last_insert
.
objectid
=
ins
->
objectid
;
ins
->
offset
=
num_blocks
;
return
0
;
error:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录