Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
0bd93ba0
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看板
提交
0bd93ba0
编写于
4月 11, 2007
作者:
C
Chris Mason
提交者:
David Woodhouse
4月 11, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: early support for multiple devices
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
cac87faa
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
76 addition
and
5 deletion
+76
-5
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+65
-5
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+11
-0
未找到文件。
fs/btrfs/ctree.h
浏览文件 @
0bd93ba0
...
...
@@ -13,10 +13,11 @@ extern struct kmem_cache *btrfs_path_cachep;
#define BTRFS_MAGIC "_BtRfS_M"
#define BTRFS_ROOT_TREE_OBJECTID 1ULL
#define BTRFS_EXTENT_TREE_OBJECTID 2ULL
#define BTRFS_FS_TREE_OBJECTID 3ULL
#define BTRFS_ROOT_TREE_DIR_OBJECTID 4ULL
#define BTRFS_FIRST_FREE_OBJECTID 5ULL
#define BTRFS_DEV_TREE_OBJECTID 2ULL
#define BTRFS_EXTENT_TREE_OBJECTID 3ULL
#define BTRFS_FS_TREE_OBJECTID 4ULL
#define BTRFS_ROOT_TREE_DIR_OBJECTID 5ULL
#define BTRFS_FIRST_FREE_OBJECTID 6ULL
/*
* we can actually store much bigger names, but lets not confuse the rest
...
...
@@ -90,6 +91,10 @@ struct btrfs_super_block {
__le64
total_blocks
;
__le64
blocks_used
;
__le64
root_dir_objectid
;
/* fields below here vary with the underlying disk */
__le64
device_block_start
;
__le64
device_num_blocks
;
__le64
device_root
;
}
__attribute__
((
__packed__
));
/*
...
...
@@ -223,10 +228,15 @@ struct btrfs_csum_item {
u8
csum
[
BTRFS_CSUM_SIZE
];
}
__attribute__
((
__packed__
));
struct
btrfs_device_item
{
__le16
pathlen
;
}
__attribute__
((
__packed__
));
struct
crypto_hash
;
struct
btrfs_fs_info
{
struct
btrfs_root
*
extent_root
;
struct
btrfs_root
*
tree_root
;
struct
btrfs_root
*
dev_root
;
struct
btrfs_key
current_insert
;
struct
btrfs_key
last_insert
;
struct
radix_tree_root
fs_roots_radix
;
...
...
@@ -312,11 +322,16 @@ struct btrfs_root {
*/
#define BTRFS_EXTENT_ITEM_KEY 8
/*
* dev items list the devices that make up the FS
*/
#define BTRFS_DEV_ITEM_KEY 9
/*
* string items are for debugging. They just store a short string of
* data in the FS
*/
#define BTRFS_STRING_ITEM_KEY
9
#define BTRFS_STRING_ITEM_KEY
10
static
inline
u64
btrfs_inode_generation
(
struct
btrfs_inode_item
*
i
)
{
...
...
@@ -782,6 +797,40 @@ static inline void btrfs_set_super_root_dir(struct btrfs_super_block *s, u64
s
->
root_dir_objectid
=
cpu_to_le64
(
val
);
}
static
inline
u64
btrfs_super_device_block_start
(
struct
btrfs_super_block
*
s
)
{
return
le64_to_cpu
(
s
->
device_block_start
);
}
static
inline
void
btrfs_set_super_device_block_start
(
struct
btrfs_super_block
*
s
,
u64
val
)
{
s
->
device_block_start
=
cpu_to_le64
(
val
);
}
static
inline
u64
btrfs_super_device_num_blocks
(
struct
btrfs_super_block
*
s
)
{
return
le64_to_cpu
(
s
->
device_num_blocks
);
}
static
inline
void
btrfs_set_super_device_num_blocks
(
struct
btrfs_super_block
*
s
,
u64
val
)
{
s
->
device_num_blocks
=
cpu_to_le64
(
val
);
}
static
inline
u64
btrfs_super_device_root
(
struct
btrfs_super_block
*
s
)
{
return
le64_to_cpu
(
s
->
device_root
);
}
static
inline
void
btrfs_set_super_device_root
(
struct
btrfs_super_block
*
s
,
u64
val
)
{
s
->
device_root
=
cpu_to_le64
(
val
);
}
static
inline
u8
*
btrfs_leaf_data
(
struct
btrfs_leaf
*
l
)
{
return
(
u8
*
)
l
->
items
;
...
...
@@ -849,6 +898,17 @@ static inline void btrfs_set_file_extent_num_blocks(struct
e
->
num_blocks
=
cpu_to_le64
(
val
);
}
static
inline
u16
btrfs_device_pathlen
(
struct
btrfs_device_item
*
d
)
{
return
le16_to_cpu
(
d
->
pathlen
);
}
static
inline
void
btrfs_set_device_pathlen
(
struct
btrfs_device_item
*
d
,
u16
val
)
{
d
->
pathlen
=
cpu_to_le16
(
val
);
}
static
inline
struct
btrfs_root
*
btrfs_sb
(
struct
super_block
*
sb
)
{
return
sb
->
s_fs_info
;
...
...
fs/btrfs/disk-io.c
浏览文件 @
0bd93ba0
...
...
@@ -378,6 +378,8 @@ struct btrfs_root *open_ctree(struct super_block *sb)
{
struct
btrfs_root
*
extent_root
=
kmalloc
(
sizeof
(
struct
btrfs_root
),
GFP_NOFS
);
struct
btrfs_root
*
dev_root
=
kmalloc
(
sizeof
(
struct
btrfs_root
),
GFP_NOFS
);
struct
btrfs_root
*
tree_root
=
kmalloc
(
sizeof
(
struct
btrfs_root
),
GFP_NOFS
);
struct
btrfs_fs_info
*
fs_info
=
kmalloc
(
sizeof
(
*
fs_info
),
...
...
@@ -392,6 +394,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
fs_info
->
running_transaction
=
NULL
;
fs_info
->
tree_root
=
tree_root
;
fs_info
->
extent_root
=
extent_root
;
fs_info
->
dev_root
=
dev_root
;
fs_info
->
sb
=
sb
;
fs_info
->
btree_inode
=
new_inode
(
sb
);
fs_info
->
btree_inode
->
i_ino
=
1
;
...
...
@@ -414,6 +417,9 @@ struct btrfs_root *open_ctree(struct super_block *sb)
memset
(
&
fs_info
->
current_insert
,
0
,
sizeof
(
fs_info
->
current_insert
));
memset
(
&
fs_info
->
last_insert
,
0
,
sizeof
(
fs_info
->
last_insert
));
__setup_root
(
sb
->
s_blocksize
,
dev_root
,
fs_info
,
BTRFS_DEV_TREE_OBJECTID
);
__setup_root
(
sb
->
s_blocksize
,
tree_root
,
fs_info
,
BTRFS_ROOT_TREE_OBJECTID
);
fs_info
->
sb_buffer
=
read_tree_block
(
tree_root
,
...
...
@@ -427,6 +433,8 @@ struct btrfs_root *open_ctree(struct super_block *sb)
return
NULL
;
fs_info
->
disk_super
=
disk_super
;
dev_root
->
node
=
read_tree_block
(
tree_root
,
btrfs_super_device_root
(
disk_super
));
tree_root
->
node
=
read_tree_block
(
tree_root
,
btrfs_super_root
(
disk_super
));
BUG_ON
(
!
tree_root
->
node
);
...
...
@@ -519,6 +527,9 @@ int close_ctree(struct btrfs_root *root)
if
(
fs_info
->
extent_root
->
node
)
btrfs_block_release
(
fs_info
->
extent_root
,
fs_info
->
extent_root
->
node
);
if
(
fs_info
->
dev_root
->
node
)
btrfs_block_release
(
fs_info
->
dev_root
,
fs_info
->
dev_root
->
node
);
if
(
fs_info
->
tree_root
->
node
)
btrfs_block_release
(
fs_info
->
tree_root
,
fs_info
->
tree_root
->
node
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录