Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
952fccac
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
952fccac
编写于
2月 18, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Remove extent back refs in batches, and avoid duplicate searches
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
d7fc640e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
54 addition
and
9 deletion
+54
-9
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+54
-9
未找到文件。
fs/btrfs/extent-tree.c
浏览文件 @
952fccac
...
...
@@ -1251,6 +1251,9 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
struct
btrfs_root
*
extent_root
=
info
->
extent_root
;
struct
extent_buffer
*
leaf
;
int
ret
;
int
extent_slot
=
0
;
int
found_extent
=
0
;
int
num_to_del
=
1
;
struct
btrfs_extent_item
*
ei
;
u32
refs
;
...
...
@@ -1267,7 +1270,24 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
ref_generation
,
owner_objectid
,
owner_offset
,
1
);
if
(
ret
==
0
)
{
ret
=
btrfs_del_item
(
trans
,
extent_root
,
path
);
struct
btrfs_key
found_key
;
extent_slot
=
path
->
slots
[
0
];
while
(
extent_slot
>
0
)
{
extent_slot
--
;
btrfs_item_key_to_cpu
(
path
->
nodes
[
0
],
&
found_key
,
extent_slot
);
if
(
found_key
.
objectid
!=
bytenr
)
break
;
if
(
found_key
.
type
==
BTRFS_EXTENT_ITEM_KEY
&&
found_key
.
offset
==
num_bytes
)
{
found_extent
=
1
;
break
;
}
if
(
path
->
slots
[
0
]
-
extent_slot
>
5
)
break
;
}
if
(
!
found_extent
)
ret
=
btrfs_del_item
(
trans
,
extent_root
,
path
);
}
else
{
btrfs_print_leaf
(
extent_root
,
path
->
nodes
[
0
]);
WARN_ON
(
1
);
...
...
@@ -1276,21 +1296,46 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
root_objectid
,
ref_generation
,
owner_objectid
,
owner_offset
);
}
btrfs_release_path
(
extent_root
,
path
);
ret
=
btrfs_search_slot
(
trans
,
extent_root
,
&
key
,
path
,
-
1
,
1
);
if
(
ret
<
0
)
return
ret
;
BUG_ON
(
ret
);
if
(
!
found_extent
)
{
btrfs_release_path
(
extent_root
,
path
);
ret
=
btrfs_search_slot
(
trans
,
extent_root
,
&
key
,
path
,
-
1
,
1
);
if
(
ret
<
0
)
return
ret
;
BUG_ON
(
ret
);
extent_slot
=
path
->
slots
[
0
];
}
leaf
=
path
->
nodes
[
0
];
ei
=
btrfs_item_ptr
(
leaf
,
path
->
slots
[
0
]
,
ei
=
btrfs_item_ptr
(
leaf
,
extent_slot
,
struct
btrfs_extent_item
);
refs
=
btrfs_extent_refs
(
leaf
,
ei
);
BUG_ON
(
refs
==
0
);
refs
-=
1
;
btrfs_set_extent_refs
(
leaf
,
ei
,
refs
);
btrfs_mark_buffer_dirty
(
leaf
);
if
(
refs
==
0
&&
found_extent
&&
path
->
slots
[
0
]
==
extent_slot
+
1
)
{
/* if the back ref and the extent are next to each other
* they get deleted below in one shot
*/
path
->
slots
[
0
]
=
extent_slot
;
num_to_del
=
2
;
}
else
if
(
found_extent
)
{
/* otherwise delete the extent back ref */
ret
=
btrfs_del_item
(
trans
,
extent_root
,
path
);
BUG_ON
(
ret
);
/* if refs are 0, we need to setup the path for deletion */
if
(
refs
==
0
)
{
btrfs_release_path
(
extent_root
,
path
);
ret
=
btrfs_search_slot
(
trans
,
extent_root
,
&
key
,
path
,
-
1
,
1
);
if
(
ret
<
0
)
return
ret
;
BUG_ON
(
ret
);
}
}
if
(
refs
==
0
)
{
u64
super_used
;
u64
root_used
;
...
...
@@ -1311,8 +1356,8 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
root_used
=
btrfs_root_used
(
&
root
->
root_item
);
btrfs_set_root_used
(
&
root
->
root_item
,
root_used
-
num_bytes
);
ret
=
btrfs_del_item
(
trans
,
extent_root
,
path
);
ret
=
btrfs_del_items
(
trans
,
extent_root
,
path
,
path
->
slots
[
0
],
num_to_del
);
if
(
ret
)
{
return
ret
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录