Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
f2654de4
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
f2654de4
编写于
6月 26, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
6月 26, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Allow find_free_extent callers to pass in an exclusion range
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
4b52dff6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
49 deletion
+30
-49
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+30
-49
未找到文件。
fs/btrfs/extent-tree.c
浏览文件 @
f2654de4
...
...
@@ -25,7 +25,8 @@
static
int
find_free_extent
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
orig_root
,
u64
num_blocks
,
u64
search_start
,
u64
search_end
,
u64
hint_block
,
struct
btrfs_key
*
ins
,
int
data
);
struct
btrfs_key
*
ins
,
u64
exclude_start
,
u64
exclude_nr
,
int
data
);
static
int
finish_current_insert
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
extent_root
);
static
int
del_pending_extents
(
struct
btrfs_trans_handle
*
trans
,
struct
...
...
@@ -407,7 +408,7 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
if
(
!
path
)
return
-
ENOMEM
;
ret
=
find_free_extent
(
trans
,
root
->
fs_info
->
extent_root
,
0
,
0
,
(
u64
)
-
1
,
0
,
&
ins
,
0
);
(
u64
)
-
1
,
0
,
&
ins
,
0
,
0
,
0
);
if
(
ret
)
{
btrfs_free_path
(
path
);
return
ret
;
...
...
@@ -559,7 +560,8 @@ static int write_one_cache_group(struct btrfs_trans_handle *trans,
struct
btrfs_block_group_item
*
bi
;
struct
btrfs_key
ins
;
ret
=
find_free_extent
(
trans
,
extent_root
,
0
,
0
,
(
u64
)
-
1
,
0
,
&
ins
,
0
);
ret
=
find_free_extent
(
trans
,
extent_root
,
0
,
0
,
(
u64
)
-
1
,
0
,
&
ins
,
0
,
0
,
0
);
/* FIXME, set bit to recalc cache groups on next mount */
if
(
ret
)
return
ret
;
...
...
@@ -868,7 +870,7 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
if
(
!
path
)
return
-
ENOMEM
;
ret
=
find_free_extent
(
trans
,
root
,
0
,
0
,
(
u64
)
-
1
,
0
,
&
ins
,
0
);
ret
=
find_free_extent
(
trans
,
root
,
0
,
0
,
(
u64
)
-
1
,
0
,
&
ins
,
0
,
0
,
0
);
if
(
ret
)
{
btrfs_free_path
(
path
);
return
ret
;
...
...
@@ -987,7 +989,8 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
static
int
find_free_extent
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
orig_root
,
u64
num_blocks
,
u64
search_start
,
u64
search_end
,
u64
hint_block
,
struct
btrfs_key
*
ins
,
int
data
)
struct
btrfs_key
*
ins
,
u64
exclude_start
,
u64
exclude_nr
,
int
data
)
{
struct
btrfs_path
*
path
;
struct
btrfs_key
key
;
...
...
@@ -1191,6 +1194,11 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
goto
new_group
;
}
}
if
(
exclude_nr
>
0
&&
(
ins
->
objectid
+
num_blocks
>
exclude_start
&&
ins
->
objectid
<
exclude_start
+
exclude_nr
))
{
search_start
=
exclude_start
+
exclude_nr
;
goto
new_group
;
}
if
(
fill_prealloc
)
{
int
nr
;
test_block
=
ins
->
objectid
;
...
...
@@ -1267,6 +1275,8 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
int
pending_ret
;
u64
super_blocks_used
;
u64
search_start
=
0
;
u64
exclude_start
=
0
;
u64
exclude_nr
=
0
;
struct
btrfs_fs_info
*
info
=
root
->
fs_info
;
struct
btrfs_root
*
extent_root
=
info
->
extent_root
;
struct
btrfs_extent_item
extent_item
;
...
...
@@ -1298,33 +1308,19 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
*/
if
(
data
)
{
ret
=
find_free_extent
(
trans
,
root
,
0
,
0
,
search_end
,
0
,
&
prealloc_key
,
0
);
if
(
ret
)
{
search_end
,
0
,
&
prealloc_key
,
0
,
0
,
0
);
if
(
ret
)
return
ret
;
}
if
(
prealloc_key
.
objectid
+
prealloc_key
.
offset
>=
search_end
)
{
int
nr
=
info
->
extent_tree_prealloc_nr
;
search_end
=
info
->
extent_tree_prealloc
[
nr
-
1
]
-
1
;
}
else
{
search_start
=
info
->
extent_tree_prealloc
[
0
]
+
1
;
}
exclude_nr
=
info
->
extent_tree_prealloc_nr
;
exclude_start
=
info
->
extent_tree_prealloc
[
exclude_nr
-
1
];
}
if
(
hint_block
<
search_start
)
hint_block
=
search_start
;
/* do the real allocation */
ret
=
find_free_extent
(
trans
,
root
,
num_blocks
,
search_start
,
search_end
,
hint_block
,
ins
,
data
);
if
(
ret
)
{
if
(
search_start
==
0
)
return
ret
;
search_end
=
search_start
-
1
;
search_start
=
0
;
hint_block
=
search_start
;
ret
=
find_free_extent
(
trans
,
root
,
num_blocks
,
search_start
,
search_end
,
hint_block
,
ins
,
data
);
if
(
ret
)
return
ret
;
}
search_end
,
hint_block
,
ins
,
exclude_start
,
exclude_nr
,
data
);
if
(
ret
)
return
ret
;
/*
* if we're doing a metadata allocation, preallocate space in the
...
...
@@ -1336,29 +1332,14 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
* The unused prealloc will get reused the next time around.
*/
if
(
!
data
)
{
if
(
ins
->
objectid
+
ins
->
offset
>=
search_end
)
search_end
=
ins
->
objectid
-
1
;
else
search_start
=
ins
->
objectid
+
ins
->
offset
;
if
(
hint_block
<
search_start
)
hint_block
=
search_start
;
exclude_start
=
ins
->
objectid
;
exclude_nr
=
ins
->
offset
;
ret
=
find_free_extent
(
trans
,
root
,
0
,
search_start
,
search_end
,
hint_block
,
&
prealloc_key
,
0
);
if
(
ret
)
{
if
(
search_start
==
0
)
return
ret
;
search_end
=
search_start
-
1
;
search_start
=
0
;
hint_block
=
search_start
;
ret
=
find_free_extent
(
trans
,
root
,
0
,
search_start
,
search_end
,
hint_block
,
&
prealloc_key
,
0
);
if
(
ret
)
return
ret
;
}
&
prealloc_key
,
exclude_start
,
exclude_nr
,
0
);
if
(
ret
)
return
ret
;
}
super_blocks_used
=
btrfs_super_blocks_used
(
&
info
->
super_copy
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录