Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
bb91a63f
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
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看板
提交
bb91a63f
编写于
6月 02, 2016
作者:
M
Mike Snitzer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dm raid: rename _in_range to __within_range
Signed-off-by:
N
Mike Snitzer
<
snitzer@redhat.com
>
上级
ef9b85a6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
14 deletion
+14
-14
drivers/md/dm-raid.c
drivers/md/dm-raid.c
+14
-14
未找到文件。
drivers/md/dm-raid.c
浏览文件 @
bb91a63f
...
...
@@ -244,7 +244,7 @@ static struct raid_type {
};
/* True, if @v is in inclusive range [@min, @max] */
static
bool
_in_range
(
long
v
,
long
min
,
long
max
)
static
bool
_
_with
in_range
(
long
v
,
long
min
,
long
max
)
{
return
v
>=
min
&&
v
<=
max
;
}
...
...
@@ -385,7 +385,7 @@ static bool rt_is_raid10(struct raid_type *rt)
/* Return true, if raid type in @rt is raid4/5 */
static
bool
rt_is_raid45
(
struct
raid_type
*
rt
)
{
return
_in_range
(
rt
->
level
,
4
,
5
);
return
_
_with
in_range
(
rt
->
level
,
4
,
5
);
}
/* Return true, if raid type in @rt is raid6 */
...
...
@@ -397,7 +397,7 @@ static bool rt_is_raid6(struct raid_type *rt)
/* Return true, if raid type in @rt is raid4/5/6 */
static
bool
rt_is_raid456
(
struct
raid_type
*
rt
)
{
return
_in_range
(
rt
->
level
,
4
,
6
);
return
_
_with
in_range
(
rt
->
level
,
4
,
6
);
}
/* END: raid level bools */
...
...
@@ -1123,7 +1123,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
* indexes of replaced devices and to set up additional
* devices on raid level takeover.
*/
if
(
!
_in_range
(
value
,
0
,
rs
->
raid_disks
-
1
))
{
if
(
!
_
_with
in_range
(
value
,
0
,
rs
->
raid_disks
-
1
))
{
rs
->
ti
->
error
=
"Invalid rebuild index given"
;
return
-
EINVAL
;
}
...
...
@@ -1144,7 +1144,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
return
-
EINVAL
;
}
if
(
!
_in_range
(
value
,
0
,
rs
->
md
.
raid_disks
-
1
))
{
if
(
!
_
_with
in_range
(
value
,
0
,
rs
->
md
.
raid_disks
-
1
))
{
rs
->
ti
->
error
=
"Invalid write_mostly index given"
;
return
-
EINVAL
;
}
...
...
@@ -1202,7 +1202,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
return
-
EINVAL
;
}
/* Ensure MAX_RAID_DEVICES and raid type minimal_devs! */
if
(
!
_in_range
(
abs
(
value
),
1
,
MAX_RAID_DEVICES
-
rt
->
minimal_devs
))
{
if
(
!
_
_with
in_range
(
abs
(
value
),
1
,
MAX_RAID_DEVICES
-
rt
->
minimal_devs
))
{
rs
->
ti
->
error
=
"Too many delta_disk requested"
;
return
-
EINVAL
;
}
...
...
@@ -1262,7 +1262,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
return
-
EINVAL
;
}
if
(
!
_in_range
(
value
,
2
,
rs
->
md
.
raid_disks
))
{
if
(
!
_
_with
in_range
(
value
,
2
,
rs
->
md
.
raid_disks
))
{
rs
->
ti
->
error
=
"Bad value for 'raid10_copies'"
;
return
-
EINVAL
;
}
...
...
@@ -1380,7 +1380,7 @@ static int rs_check_takeover(struct raid_set *rs)
return
0
;
/* raid0 with multiple disks -> raid4/5/6 */
if
(
_in_range
(
mddev
->
new_level
,
4
,
6
)
&&
if
(
_
_with
in_range
(
mddev
->
new_level
,
4
,
6
)
&&
mddev
->
new_layout
==
ALGORITHM_PARITY_N
&&
mddev
->
raid_disks
>
1
)
return
0
;
...
...
@@ -1418,14 +1418,14 @@ static int rs_check_takeover(struct raid_set *rs)
return
0
;
/* raid10_{near,far} with 2 disks -> raid4/5 */
if
(
_in_range
(
mddev
->
new_level
,
4
,
5
)
&&
if
(
_
_with
in_range
(
mddev
->
new_level
,
4
,
5
)
&&
mddev
->
raid_disks
==
2
)
return
0
;
break
;
case
1
:
/* raid1 with 2 disks -> raid4/5 */
if
(
_in_range
(
mddev
->
new_level
,
4
,
5
)
&&
if
(
_
_with
in_range
(
mddev
->
new_level
,
4
,
5
)
&&
mddev
->
raid_disks
==
2
)
{
mddev
->
degraded
=
1
;
return
0
;
...
...
@@ -1453,7 +1453,7 @@ static int rs_check_takeover(struct raid_set *rs)
return
0
;
/* raid4 -> raid5/6 with parity N */
if
(
_in_range
(
mddev
->
new_level
,
5
,
6
)
&&
if
(
_
_with
in_range
(
mddev
->
new_level
,
5
,
6
)
&&
mddev
->
layout
==
ALGORITHM_PARITY_N
)
return
0
;
break
;
...
...
@@ -1477,7 +1477,7 @@ static int rs_check_takeover(struct raid_set *rs)
/* raid5 with parity N -> raid6 with parity N */
if
(
mddev
->
new_level
==
6
&&
((
mddev
->
layout
==
ALGORITHM_PARITY_N
&&
mddev
->
new_layout
==
ALGORITHM_PARITY_N
)
||
_in_range
(
mddev
->
new_layout
,
ALGORITHM_LEFT_ASYMMETRIC_6
,
ALGORITHM_RIGHT_SYMMETRIC_6
)))
_
_with
in_range
(
mddev
->
new_layout
,
ALGORITHM_LEFT_ASYMMETRIC_6
,
ALGORITHM_RIGHT_SYMMETRIC_6
)))
return
0
;
break
;
...
...
@@ -1495,7 +1495,7 @@ static int rs_check_takeover(struct raid_set *rs)
/* raid6_*_n with parity N -> raid5_* */
if
(
mddev
->
new_level
==
5
&&
((
mddev
->
layout
==
ALGORITHM_PARITY_N
&&
mddev
->
new_layout
==
ALGORITHM_PARITY_N
)
||
_in_range
(
mddev
->
new_layout
,
ALGORITHM_LEFT_ASYMMETRIC
,
ALGORITHM_RIGHT_SYMMETRIC
)))
_
_with
in_range
(
mddev
->
new_layout
,
ALGORITHM_LEFT_ASYMMETRIC
,
ALGORITHM_RIGHT_SYMMETRIC
)))
return
0
;
default:
...
...
@@ -2291,7 +2291,7 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
if
(
dm_read_arg
(
_args
+
1
,
&
as_nrd
,
&
num_raid_devs
,
&
ti
->
error
))
return
-
EINVAL
;
if
(
!
_in_range
(
num_raid_devs
,
1
,
MAX_RAID_DEVICES
))
{
if
(
!
_
_with
in_range
(
num_raid_devs
,
1
,
MAX_RAID_DEVICES
))
{
ti
->
error
=
"Invalid number of supplied raid devices"
;
return
-
EINVAL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录