Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
5be6f7f1
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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看板
提交
5be6f7f1
编写于
4月 05, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
4月 05, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: dirindex optimizations
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
7fcde0e3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
50 addition
and
17 deletion
+50
-17
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+3
-0
fs/btrfs/dir-item.c
fs/btrfs/dir-item.c
+4
-1
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+5
-1
fs/btrfs/inode-map.c
fs/btrfs/inode-map.c
+33
-15
fs/btrfs/super.c
fs/btrfs/super.c
+5
-0
未找到文件。
fs/btrfs/ctree.h
浏览文件 @
5be6f7f1
...
@@ -239,6 +239,7 @@ struct btrfs_fs_info {
...
@@ -239,6 +239,7 @@ struct btrfs_fs_info {
struct
radix_tree_root
pinned_radix
;
struct
radix_tree_root
pinned_radix
;
u64
last_inode_alloc
;
u64
last_inode_alloc
;
u64
generation
;
u64
generation
;
u64
highest_inode
;
struct
btrfs_transaction
*
running_transaction
;
struct
btrfs_transaction
*
running_transaction
;
struct
btrfs_super_block
*
disk_super
;
struct
btrfs_super_block
*
disk_super
;
struct
buffer_head
*
sb_buffer
;
struct
buffer_head
*
sb_buffer
;
...
@@ -970,6 +971,8 @@ int btrfs_insert_inode_map(struct btrfs_trans_handle *trans,
...
@@ -970,6 +971,8 @@ int btrfs_insert_inode_map(struct btrfs_trans_handle *trans,
int
btrfs_lookup_inode_map
(
struct
btrfs_trans_handle
*
trans
,
int
btrfs_lookup_inode_map
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
u64
objectid
,
int
mod
);
u64
objectid
,
int
mod
);
int
btrfs_find_highest_inode
(
struct
btrfs_root
*
fs_root
,
u64
*
objectid
);
/* inode-item.c */
/* inode-item.c */
int
btrfs_insert_inode
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
int
btrfs_insert_inode
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
u64
objectid
,
struct
btrfs_inode_item
*
root
,
u64
objectid
,
struct
btrfs_inode_item
...
...
fs/btrfs/dir-item.c
浏览文件 @
5be6f7f1
...
@@ -92,6 +92,7 @@ int btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
...
@@ -92,6 +92,7 @@ int btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
int
cow
=
mod
!=
0
;
int
cow
=
mod
!=
0
;
struct
btrfs_disk_key
*
found_key
;
struct
btrfs_disk_key
*
found_key
;
struct
btrfs_leaf
*
leaf
;
struct
btrfs_leaf
*
leaf
;
u32
overflow
;
key
.
objectid
=
dir
;
key
.
objectid
=
dir
;
key
.
flags
=
0
;
key
.
flags
=
0
;
...
@@ -119,8 +120,10 @@ int btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
...
@@ -119,8 +120,10 @@ int btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
if
(
btrfs_match_dir_item_name
(
root
,
path
,
name
,
name_len
))
if
(
btrfs_match_dir_item_name
(
root
,
path
,
name
,
name_len
))
return
0
;
return
0
;
if
(
btrfs_disk_key_overflow
(
found_key
)
==
0
)
overflow
=
btrfs_disk_key_overflow
(
found_key
);
if
(
overflow
==
0
)
return
1
;
return
1
;
btrfs_set_key_overflow
(
&
key
,
overflow
-
1
);
btrfs_release_path
(
root
,
path
);
btrfs_release_path
(
root
,
path
);
}
}
return
1
;
return
1
;
...
...
fs/btrfs/disk-io.c
浏览文件 @
5be6f7f1
...
@@ -311,6 +311,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
...
@@ -311,6 +311,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
fs_info
->
extent_root
=
extent_root
;
fs_info
->
extent_root
=
extent_root
;
fs_info
->
inode_root
=
inode_root
;
fs_info
->
inode_root
=
inode_root
;
fs_info
->
last_inode_alloc
=
0
;
fs_info
->
last_inode_alloc
=
0
;
fs_info
->
highest_inode
=
0
;
fs_info
->
sb
=
sb
;
fs_info
->
sb
=
sb
;
fs_info
->
btree_inode
=
new_inode
(
sb
);
fs_info
->
btree_inode
=
new_inode
(
sb
);
fs_info
->
btree_inode
->
i_ino
=
1
;
fs_info
->
btree_inode
->
i_ino
=
1
;
...
@@ -360,12 +361,15 @@ printk("failed2\n");
...
@@ -360,12 +361,15 @@ printk("failed2\n");
ret
=
find_and_setup_root
(
sb
->
s_blocksize
,
tree_root
,
fs_info
,
ret
=
find_and_setup_root
(
sb
->
s_blocksize
,
tree_root
,
fs_info
,
BTRFS_FS_TREE_OBJECTID
,
root
);
BTRFS_FS_TREE_OBJECTID
,
root
);
mutex_unlock
(
&
fs_info
->
fs_mutex
);
BUG_ON
(
ret
);
BUG_ON
(
ret
);
root
->
commit_root
=
root
->
node
;
root
->
commit_root
=
root
->
node
;
get_bh
(
root
->
node
);
get_bh
(
root
->
node
);
root
->
ref_cows
=
1
;
root
->
ref_cows
=
1
;
root
->
fs_info
->
generation
=
root
->
root_key
.
offset
+
1
;
root
->
fs_info
->
generation
=
root
->
root_key
.
offset
+
1
;
ret
=
btrfs_find_highest_inode
(
root
,
&
root
->
fs_info
->
last_inode_alloc
);
if
(
ret
==
0
)
fs_info
->
highest_inode
=
fs_info
->
last_inode_alloc
;
mutex_unlock
(
&
fs_info
->
fs_mutex
);
return
root
;
return
root
;
}
}
...
...
fs/btrfs/inode-map.c
浏览文件 @
5be6f7f1
...
@@ -3,6 +3,37 @@
...
@@ -3,6 +3,37 @@
#include "disk-io.h"
#include "disk-io.h"
#include "transaction.h"
#include "transaction.h"
int
btrfs_find_highest_inode
(
struct
btrfs_root
*
fs_root
,
u64
*
objectid
)
{
struct
btrfs_path
*
path
;
int
ret
;
struct
btrfs_leaf
*
l
;
struct
btrfs_root
*
root
=
fs_root
->
fs_info
->
inode_root
;
struct
btrfs_key
search_key
;
int
slot
;
path
=
btrfs_alloc_path
();
BUG_ON
(
!
path
);
search_key
.
objectid
=
(
u64
)
-
1
;
search_key
.
offset
=
(
u64
)
-
1
;
ret
=
btrfs_search_slot
(
NULL
,
root
,
&
search_key
,
path
,
0
,
0
);
if
(
ret
<
0
)
goto
error
;
BUG_ON
(
ret
==
0
);
if
(
path
->
slots
[
0
]
>
0
)
{
slot
=
path
->
slots
[
0
]
-
1
;
l
=
btrfs_buffer_leaf
(
path
->
nodes
[
0
]);
*
objectid
=
btrfs_disk_key_objectid
(
&
l
->
items
[
slot
].
key
);
}
else
{
*
objectid
=
BTRFS_FIRST_FREE_OBJECTID
;
}
ret
=
0
;
error:
btrfs_free_path
(
path
);
return
ret
;
}
/*
/*
* walks the btree of allocated inodes and find a hole.
* walks the btree of allocated inodes and find a hole.
*/
*/
...
@@ -28,21 +59,6 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
...
@@ -28,21 +59,6 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
btrfs_set_key_type
(
&
search_key
,
BTRFS_INODE_MAP_ITEM_KEY
);
btrfs_set_key_type
(
&
search_key
,
BTRFS_INODE_MAP_ITEM_KEY
);
search_start
=
fs_root
->
fs_info
->
last_inode_alloc
;
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_start
=
max
(
search_start
,
BTRFS_FIRST_FREE_OBJECTID
);
search_key
.
objectid
=
search_start
;
search_key
.
objectid
=
search_start
;
search_key
.
offset
=
0
;
search_key
.
offset
=
0
;
...
@@ -129,6 +145,8 @@ int btrfs_insert_inode_map(struct btrfs_trans_handle *trans,
...
@@ -129,6 +145,8 @@ int btrfs_insert_inode_map(struct btrfs_trans_handle *trans,
path
->
slots
[
0
],
struct
btrfs_inode_map_item
);
path
->
slots
[
0
],
struct
btrfs_inode_map_item
);
btrfs_cpu_key_to_disk
(
&
inode_item
->
key
,
location
);
btrfs_cpu_key_to_disk
(
&
inode_item
->
key
,
location
);
btrfs_mark_buffer_dirty
(
path
->
nodes
[
0
]);
btrfs_mark_buffer_dirty
(
path
->
nodes
[
0
]);
if
(
objectid
>
fs_root
->
fs_info
->
highest_inode
)
fs_root
->
fs_info
->
highest_inode
=
objectid
;
out:
out:
btrfs_release_path
(
inode_root
,
path
);
btrfs_release_path
(
inode_root
,
path
);
btrfs_free_path
(
path
);
btrfs_free_path
(
path
);
...
...
fs/btrfs/super.c
浏览文件 @
5be6f7f1
...
@@ -482,6 +482,11 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -482,6 +482,11 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
item
=
leaf
->
items
+
slot
;
item
=
leaf
->
items
+
slot
;
if
(
btrfs_disk_key_objectid
(
&
item
->
key
)
!=
key
.
objectid
)
if
(
btrfs_disk_key_objectid
(
&
item
->
key
)
!=
key
.
objectid
)
break
;
break
;
if
(
btrfs_disk_key_offset
(
&
item
->
key
)
>
root
->
fs_info
->
highest_inode
)
{
printk
(
"stopping at highest inode %Lu
\n
"
,
root
->
fs_info
->
highest_inode
);
break
;
}
if
(
btrfs_disk_key_type
(
&
item
->
key
)
!=
BTRFS_DIR_INDEX_KEY
)
if
(
btrfs_disk_key_type
(
&
item
->
key
)
!=
BTRFS_DIR_INDEX_KEY
)
continue
;
continue
;
if
(
btrfs_disk_key_offset
(
&
item
->
key
)
<
filp
->
f_pos
)
if
(
btrfs_disk_key_offset
(
&
item
->
key
)
<
filp
->
f_pos
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录