Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
a443755f
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
a443755f
编写于
4月 18, 2008
作者:
C
Chris Mason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Btrfs: Check device uuids along with devids
Signed-off-by:
N
Chris Mason
<
chris.mason@oracle.com
>
上级
41471e83
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
7 deletion
+28
-7
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+5
-0
fs/btrfs/volumes.c
fs/btrfs/volumes.c
+23
-7
未找到文件。
fs/btrfs/ctree.h
浏览文件 @
a443755f
...
...
@@ -800,6 +800,11 @@ static inline struct btrfs_stripe *btrfs_stripe_nr(struct btrfs_chunk *c,
return
(
struct
btrfs_stripe
*
)
offset
;
}
static
inline
char
*
btrfs_stripe_dev_uuid_nr
(
struct
btrfs_chunk
*
c
,
int
nr
)
{
return
btrfs_stripe_dev_uuid
(
btrfs_stripe_nr
(
c
,
nr
));
}
static
inline
u64
btrfs_stripe_offset_nr
(
struct
extent_buffer
*
eb
,
struct
btrfs_chunk
*
c
,
int
nr
)
{
...
...
fs/btrfs/volumes.c
浏览文件 @
a443755f
...
...
@@ -69,15 +69,18 @@ int btrfs_cleanup_fs_uuids(void)
return
0
;
}
static
struct
btrfs_device
*
__find_device
(
struct
list_head
*
head
,
u64
devid
)
static
struct
btrfs_device
*
__find_device
(
struct
list_head
*
head
,
u64
devid
,
u8
*
uuid
)
{
struct
btrfs_device
*
dev
;
struct
list_head
*
cur
;
list_for_each
(
cur
,
head
)
{
dev
=
list_entry
(
cur
,
struct
btrfs_device
,
dev_list
);
if
(
dev
->
devid
==
devid
)
if
(
dev
->
devid
==
devid
&&
!
memcmp
(
dev
->
uuid
,
uuid
,
BTRFS_UUID_SIZE
))
{
return
dev
;
}
}
return
NULL
;
}
...
...
@@ -117,7 +120,8 @@ static int device_list_add(const char *path,
fs_devices
->
num_devices
=
0
;
device
=
NULL
;
}
else
{
device
=
__find_device
(
&
fs_devices
->
devices
,
devid
);
device
=
__find_device
(
&
fs_devices
->
devices
,
devid
,
disk_super
->
dev_item
.
uuid
);
}
if
(
!
device
)
{
device
=
kzalloc
(
sizeof
(
*
device
),
GFP_NOFS
);
...
...
@@ -126,6 +130,8 @@ static int device_list_add(const char *path,
return
-
ENOMEM
;
}
device
->
devid
=
devid
;
memcpy
(
device
->
uuid
,
disk_super
->
dev_item
.
uuid
,
BTRFS_UUID_SIZE
);
device
->
barriers
=
1
;
spin_lock_init
(
&
device
->
io_lock
);
device
->
name
=
kstrdup
(
path
,
GFP_NOFS
);
...
...
@@ -1098,11 +1104,12 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
return
0
;
}
struct
btrfs_device
*
btrfs_find_device
(
struct
btrfs_root
*
root
,
u64
devid
)
struct
btrfs_device
*
btrfs_find_device
(
struct
btrfs_root
*
root
,
u64
devid
,
u8
*
uuid
)
{
struct
list_head
*
head
=
&
root
->
fs_info
->
fs_devices
->
devices
;
return
__find_device
(
head
,
devid
);
return
__find_device
(
head
,
devid
,
uuid
);
}
static
int
read_one_chunk
(
struct
btrfs_root
*
root
,
struct
btrfs_key
*
key
,
...
...
@@ -1115,6 +1122,7 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
u64
logical
;
u64
length
;
u64
devid
;
u8
uuid
[
BTRFS_UUID_SIZE
];
int
num_stripes
;
int
ret
;
int
i
;
...
...
@@ -1163,7 +1171,10 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
map
->
stripes
[
i
].
physical
=
btrfs_stripe_offset_nr
(
leaf
,
chunk
,
i
);
devid
=
btrfs_stripe_devid_nr
(
leaf
,
chunk
,
i
);
map
->
stripes
[
i
].
dev
=
btrfs_find_device
(
root
,
devid
);
read_extent_buffer
(
leaf
,
uuid
,
(
unsigned
long
)
btrfs_stripe_dev_uuid_nr
(
chunk
,
i
),
BTRFS_UUID_SIZE
);
map
->
stripes
[
i
].
dev
=
btrfs_find_device
(
root
,
devid
,
uuid
);
if
(
!
map
->
stripes
[
i
].
dev
)
{
kfree
(
map
);
free_extent_map
(
em
);
...
...
@@ -1207,8 +1218,13 @@ static int read_one_dev(struct btrfs_root *root,
struct
btrfs_device
*
device
;
u64
devid
;
int
ret
;
u8
dev_uuid
[
BTRFS_UUID_SIZE
];
devid
=
btrfs_device_id
(
leaf
,
dev_item
);
device
=
btrfs_find_device
(
root
,
devid
);
read_extent_buffer
(
leaf
,
dev_uuid
,
(
unsigned
long
)
btrfs_device_uuid
(
dev_item
),
BTRFS_UUID_SIZE
);
device
=
btrfs_find_device
(
root
,
devid
,
dev_uuid
);
if
(
!
device
)
{
printk
(
"warning devid %Lu not found already
\n
"
,
devid
);
device
=
kzalloc
(
sizeof
(
*
device
),
GFP_NOFS
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录