Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
b1a4d965
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,发现更多精彩内容 >>
提交
b1a4d965
编写于
4月 04, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
4月 04, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: tweak the inode-map and free extent search starts on cold mount
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
e8f05c45
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
39 addition
and
13 deletion
+39
-13
fs/btrfs/TODO
fs/btrfs/TODO
+0
-2
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+0
-1
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+0
-1
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+19
-2
fs/btrfs/inode-map.c
fs/btrfs/inode-map.c
+20
-7
未找到文件。
fs/btrfs/TODO
浏览文件 @
b1a4d965
* cleanup, add more error checking, get rid of BUG_ONs
* Fix ENOSPC handling
* Do checksumming
* Add block mapping tree (simple dm layer)
* Make allocator smarter
* make level a field in header
* add a block group to struct inode
* Make directory hashing work on 32 bit
* Make sure nobh stuff is working properly for cows
...
...
fs/btrfs/ctree.h
浏览文件 @
b1a4d965
...
...
@@ -238,7 +238,6 @@ struct btrfs_fs_info {
struct
radix_tree_root
pending_del_radix
;
struct
radix_tree_root
pinned_radix
;
u64
last_inode_alloc
;
u64
last_inode_alloc_dirid
;
u64
generation
;
struct
btrfs_transaction
*
running_transaction
;
struct
btrfs_super_block
*
disk_super
;
...
...
fs/btrfs/disk-io.c
浏览文件 @
b1a4d965
...
...
@@ -311,7 +311,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
fs_info
->
extent_root
=
extent_root
;
fs_info
->
inode_root
=
inode_root
;
fs_info
->
last_inode_alloc
=
0
;
fs_info
->
last_inode_alloc_dirid
=
0
;
fs_info
->
sb
=
sb
;
fs_info
->
btree_inode
=
new_inode
(
sb
);
fs_info
->
btree_inode
->
i_ino
=
1
;
...
...
fs/btrfs/extent-tree.c
浏览文件 @
b1a4d965
...
...
@@ -339,13 +339,30 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
int
total_needed
=
num_blocks
;
int
level
;
path
=
btrfs_alloc_path
();
ins
->
flags
=
0
;
btrfs_set_key_type
(
ins
,
BTRFS_EXTENT_ITEM_KEY
);
level
=
btrfs_header_level
(
btrfs_buffer_header
(
root
->
node
));
total_needed
+=
(
level
+
1
)
*
3
;
if
(
root
->
fs_info
->
last_insert
.
objectid
==
0
&&
search_end
==
(
u64
)
-
1
)
{
struct
btrfs_disk_key
*
last_key
;
btrfs_init_path
(
path
);
ins
->
objectid
=
(
u64
)
-
1
;
ins
->
offset
=
(
u64
)
-
1
;
ret
=
btrfs_search_slot
(
trans
,
root
,
ins
,
path
,
0
,
0
);
if
(
ret
<
0
)
goto
error
;
BUG_ON
(
ret
==
0
);
if
(
path
->
slots
[
0
]
>
0
)
path
->
slots
[
0
]
--
;
l
=
btrfs_buffer_leaf
(
path
->
nodes
[
0
]);
last_key
=
&
l
->
items
[
path
->
slots
[
0
]].
key
;
search_start
=
btrfs_disk_key_objectid
(
last_key
);
}
if
(
root
->
fs_info
->
last_insert
.
objectid
>
search_start
)
search_start
=
root
->
fs_info
->
last_insert
.
objectid
;
ins
->
flags
=
0
;
btrfs_set_key_type
(
ins
,
BTRFS_EXTENT_ITEM_KEY
);
path
=
btrfs_alloc_path
();
check_failed:
...
...
fs/btrfs/inode-map.c
浏览文件 @
b1a4d965
...
...
@@ -22,17 +22,31 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
struct
btrfs_key
search_key
;
u64
search_start
=
dirid
;
if
(
fs_root
->
fs_info
->
last_inode_alloc_dirid
==
dirid
)
search_start
=
fs_root
->
fs_info
->
last_inode_alloc
;
path
=
btrfs_alloc_path
();
BUG_ON
(
!
path
);
search_key
.
flags
=
0
;
btrfs_set_key_type
(
&
search_key
,
BTRFS_INODE_MAP_ITEM_KEY
);
search_start
=
fs_root
->
fs_info
->
last_inode_alloc
;
if
(
search_start
==
0
)
{
struct
btrfs_disk_key
*
last_key
;
btrfs_init_path
(
path
);
search_key
.
objectid
=
(
u64
)
-
1
;
search_key
.
offset
=
(
u64
)
-
1
;
ret
=
btrfs_search_slot
(
trans
,
root
,
&
search_key
,
path
,
0
,
0
);
if
(
ret
<
0
)
goto
error
;
BUG_ON
(
ret
==
0
);
if
(
path
->
slots
[
0
]
>
0
)
path
->
slots
[
0
]
--
;
l
=
btrfs_buffer_leaf
(
path
->
nodes
[
0
]);
last_key
=
&
l
->
items
[
path
->
slots
[
0
]].
key
;
search_start
=
btrfs_disk_key_objectid
(
last_key
);
}
search_start
=
max
(
search_start
,
BTRFS_FIRST_FREE_OBJECTID
);
search_key
.
objectid
=
search_start
;
search_key
.
flags
=
0
;
btrfs_set_key_type
(
&
search_key
,
BTRFS_INODE_MAP_ITEM_KEY
);
search_key
.
offset
=
0
;
path
=
btrfs_alloc_path
();
BUG_ON
(
!
path
);
btrfs_init_path
(
path
);
start_found
=
0
;
ret
=
btrfs_search_slot
(
trans
,
root
,
&
search_key
,
path
,
0
,
0
);
...
...
@@ -79,7 +93,6 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
// FIXME -ENOSPC
found:
root
->
fs_info
->
last_inode_alloc
=
*
objectid
;
root
->
fs_info
->
last_inode_alloc_dirid
=
dirid
;
btrfs_release_path
(
root
,
path
);
btrfs_free_path
(
path
);
BUG_ON
(
*
objectid
<
search_start
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录