Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
611f0e00
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
611f0e00
编写于
4月 03, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Add support for duplicate blocks on a single spindle
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
8790d502
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
37 addition
and
9 deletion
+37
-9
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+1
-0
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+5
-3
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+3
-2
fs/btrfs/volumes.c
fs/btrfs/volumes.c
+28
-4
未找到文件。
fs/btrfs/ctree.h
浏览文件 @
611f0e00
...
...
@@ -419,6 +419,7 @@ struct btrfs_csum_item {
#define BTRFS_BLOCK_GROUP_METADATA (1 << 2)
#define BTRFS_BLOCK_GROUP_RAID0 (1 << 3)
#define BTRFS_BLOCK_GROUP_RAID1 (1 << 4)
#define BTRFS_BLOCK_GROUP_DUP (1 << 5)
struct
btrfs_block_group_item
{
...
...
fs/btrfs/disk-io.c
浏览文件 @
611f0e00
...
...
@@ -913,9 +913,11 @@ struct btrfs_root *open_ctree(struct super_block *sb,
fs_info
->
generation
=
btrfs_super_generation
(
disk_super
)
+
1
;
if
(
btrfs_super_num_devices
(
disk_super
)
>
0
)
{
fs_info
->
data_alloc_profile
=
BTRFS_BLOCK_GROUP_RAID0
;
fs_info
->
metadata_alloc_profile
=
BTRFS_BLOCK_GROUP_RAID1
;
fs_info
->
system_alloc_profile
=
BTRFS_BLOCK_GROUP_RAID0
;
fs_info
->
data_alloc_profile
=
BTRFS_BLOCK_GROUP_RAID0
|
BTRFS_BLOCK_GROUP_RAID1
;
fs_info
->
metadata_alloc_profile
=
BTRFS_BLOCK_GROUP_RAID1
|
BTRFS_BLOCK_GROUP_DUP
;
fs_info
->
system_alloc_profile
=
fs_info
->
metadata_alloc_profile
;
}
mutex_unlock
(
&
fs_info
->
fs_mutex
);
return
tree_root
;
...
...
fs/btrfs/extent-tree.c
浏览文件 @
611f0e00
...
...
@@ -231,7 +231,7 @@ static int noinline find_search_start(struct btrfs_root *root,
if
(
start
+
num
>
total_fs_bytes
)
goto
new_group
;
if
(
!
block_group_bits
(
cache
,
data
))
{
printk
(
"block group bits don't match %Lu %
Lu
\n
"
,
cache
->
flags
,
data
);
printk
(
"block group bits don't match %Lu %
d
\n
"
,
cache
->
flags
,
data
);
}
*
start_ret
=
start
;
return
0
;
...
...
@@ -1048,7 +1048,8 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags,
static
void
set_avail_alloc_bits
(
struct
btrfs_fs_info
*
fs_info
,
u64
flags
)
{
u64
extra_flags
=
flags
&
(
BTRFS_BLOCK_GROUP_RAID0
|
BTRFS_BLOCK_GROUP_RAID1
);
BTRFS_BLOCK_GROUP_RAID1
|
BTRFS_BLOCK_GROUP_DUP
);
if
(
extra_flags
)
{
if
(
flags
&
BTRFS_BLOCK_GROUP_DATA
)
fs_info
->
avail_data_alloc_bits
|=
extra_flags
;
...
...
fs/btrfs/volumes.c
浏览文件 @
611f0e00
...
...
@@ -627,6 +627,7 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
struct
extent_map
*
em
;
u64
physical
;
u64
calc_size
=
1024
*
1024
*
1024
;
u64
min_free
=
calc_size
;
u64
avail
;
u64
max_avail
=
0
;
int
num_stripes
=
1
;
...
...
@@ -641,6 +642,8 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
if
(
type
&
(
BTRFS_BLOCK_GROUP_RAID0
))
num_stripes
=
btrfs_super_num_devices
(
&
info
->
super_copy
);
if
(
type
&
(
BTRFS_BLOCK_GROUP_DUP
))
num_stripes
=
2
;
if
(
type
&
(
BTRFS_BLOCK_GROUP_RAID1
))
{
num_stripes
=
min_t
(
u64
,
2
,
btrfs_super_num_devices
(
&
info
->
super_copy
));
...
...
@@ -649,16 +652,23 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
INIT_LIST_HEAD
(
&
private_devs
);
cur
=
dev_list
->
next
;
index
=
0
;
if
(
type
&
BTRFS_BLOCK_GROUP_DUP
)
min_free
=
calc_size
*
2
;
/* build a private list of devices we will allocate from */
while
(
index
<
num_stripes
)
{
device
=
list_entry
(
cur
,
struct
btrfs_device
,
dev_list
);
avail
=
device
->
total_bytes
-
device
->
bytes_used
;
cur
=
cur
->
next
;
if
(
avail
>
max_avail
)
max_avail
=
avail
;
if
(
avail
>=
calc_siz
e
)
{
if
(
avail
>=
min_fre
e
)
{
list_move_tail
(
&
device
->
dev_list
,
&
private_devs
);
index
++
;
if
(
type
&
BTRFS_BLOCK_GROUP_DUP
)
index
++
;
}
if
(
cur
==
dev_list
)
break
;
...
...
@@ -689,17 +699,22 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
stripes
=
&
chunk
->
stripe
;
if
(
type
&
BTRFS_BLOCK_GROUP_RAID1
)
if
(
type
&
(
BTRFS_BLOCK_GROUP_RAID1
|
BTRFS_BLOCK_GROUP_DUP
)
)
*
num_bytes
=
calc_size
;
else
*
num_bytes
=
calc_size
*
num_stripes
;
index
=
0
;
printk
(
"new chunk type %Lu start %Lu size %Lu
\n
"
,
type
,
key
.
objectid
,
*
num_bytes
);
while
(
index
<
num_stripes
)
{
BUG_ON
(
list_empty
(
&
private_devs
));
cur
=
private_devs
.
next
;
device
=
list_entry
(
cur
,
struct
btrfs_device
,
dev_list
);
list_move_tail
(
&
device
->
dev_list
,
dev_list
);
/* loop over this device again if we're doing a dup group */
if
(
!
(
type
&
BTRFS_BLOCK_GROUP_DUP
)
||
(
index
==
num_stripes
-
1
))
list_move_tail
(
&
device
->
dev_list
,
dev_list
);
ret
=
btrfs_alloc_dev_extent
(
trans
,
device
,
key
.
objectid
,
...
...
@@ -839,6 +854,14 @@ int btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
}
*
total_devs
=
1
;
}
}
else
if
(
map
->
type
&
BTRFS_BLOCK_GROUP_DUP
)
{
if
(
rw
==
WRITE
)
{
*
total_devs
=
map
->
num_stripes
;
stripe_index
=
dev_nr
;
}
else
{
stripe_index
=
0
;
*
total_devs
=
1
;
}
}
else
{
/*
* after this do_div call, stripe_nr is the number of stripes
...
...
@@ -851,7 +874,8 @@ int btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
*
phys
=
map
->
stripes
[
stripe_index
].
physical
+
stripe_offset
+
stripe_nr
*
map
->
stripe_len
;
if
(
map
->
type
&
(
BTRFS_BLOCK_GROUP_RAID0
|
BTRFS_BLOCK_GROUP_RAID1
))
{
if
(
map
->
type
&
(
BTRFS_BLOCK_GROUP_RAID0
|
BTRFS_BLOCK_GROUP_RAID1
|
BTRFS_BLOCK_GROUP_DUP
))
{
/* we limit the length of each bio to what fits in a stripe */
*
length
=
min_t
(
u64
,
em
->
len
-
offset
,
map
->
stripe_len
-
stripe_offset
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录