Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
bb91a63f
Commit
bb91a63f
authored
Jun 02, 2016
by
Mike Snitzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dm raid: rename _in_range to __within_range
Signed-off-by:
Mike Snitzer
<
snitzer@redhat.com
>
parent
ef9b85a6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
drivers/md/dm-raid.c
drivers/md/dm-raid.c
+14
-14
No files found.
drivers/md/dm-raid.c
View file @
bb91a63f
...
@@ -244,7 +244,7 @@ static struct raid_type {
...
@@ -244,7 +244,7 @@ static struct raid_type {
};
};
/* True, if @v is in inclusive range [@min, @max] */
/* 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
;
return
v
>=
min
&&
v
<=
max
;
}
}
...
@@ -385,7 +385,7 @@ static bool rt_is_raid10(struct raid_type *rt)
...
@@ -385,7 +385,7 @@ static bool rt_is_raid10(struct raid_type *rt)
/* Return true, if raid type in @rt is raid4/5 */
/* Return true, if raid type in @rt is raid4/5 */
static
bool
rt_is_raid45
(
struct
raid_type
*
rt
)
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 */
/* Return true, if raid type in @rt is raid6 */
...
@@ -397,7 +397,7 @@ static bool rt_is_raid6(struct raid_type *rt)
...
@@ -397,7 +397,7 @@ static bool rt_is_raid6(struct raid_type *rt)
/* Return true, if raid type in @rt is raid4/5/6 */
/* Return true, if raid type in @rt is raid4/5/6 */
static
bool
rt_is_raid456
(
struct
raid_type
*
rt
)
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 */
/* END: raid level bools */
...
@@ -1123,7 +1123,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
...
@@ -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
* indexes of replaced devices and to set up additional
* devices on raid level takeover.
* 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"
;
rs
->
ti
->
error
=
"Invalid rebuild index given"
;
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1144,7 +1144,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
...
@@ -1144,7 +1144,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
return
-
EINVAL
;
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"
;
rs
->
ti
->
error
=
"Invalid write_mostly index given"
;
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1202,7 +1202,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
...
@@ -1202,7 +1202,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
return
-
EINVAL
;
return
-
EINVAL
;
}
}
/* Ensure MAX_RAID_DEVICES and raid type minimal_devs! */
/* 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"
;
rs
->
ti
->
error
=
"Too many delta_disk requested"
;
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1262,7 +1262,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
...
@@ -1262,7 +1262,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
return
-
EINVAL
;
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'"
;
rs
->
ti
->
error
=
"Bad value for 'raid10_copies'"
;
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1380,7 +1380,7 @@ static int rs_check_takeover(struct raid_set *rs)
...
@@ -1380,7 +1380,7 @@ static int rs_check_takeover(struct raid_set *rs)
return
0
;
return
0
;
/* raid0 with multiple disks -> raid4/5/6 */
/* 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
->
new_layout
==
ALGORITHM_PARITY_N
&&
mddev
->
raid_disks
>
1
)
mddev
->
raid_disks
>
1
)
return
0
;
return
0
;
...
@@ -1418,14 +1418,14 @@ static int rs_check_takeover(struct raid_set *rs)
...
@@ -1418,14 +1418,14 @@ static int rs_check_takeover(struct raid_set *rs)
return
0
;
return
0
;
/* raid10_{near,far} with 2 disks -> raid4/5 */
/* 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
)
mddev
->
raid_disks
==
2
)
return
0
;
return
0
;
break
;
break
;
case
1
:
case
1
:
/* raid1 with 2 disks -> raid4/5 */
/* 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
->
raid_disks
==
2
)
{
mddev
->
degraded
=
1
;
mddev
->
degraded
=
1
;
return
0
;
return
0
;
...
@@ -1453,7 +1453,7 @@ static int rs_check_takeover(struct raid_set *rs)
...
@@ -1453,7 +1453,7 @@ static int rs_check_takeover(struct raid_set *rs)
return
0
;
return
0
;
/* raid4 -> raid5/6 with parity N */
/* 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
)
mddev
->
layout
==
ALGORITHM_PARITY_N
)
return
0
;
return
0
;
break
;
break
;
...
@@ -1477,7 +1477,7 @@ static int rs_check_takeover(struct raid_set *rs)
...
@@ -1477,7 +1477,7 @@ static int rs_check_takeover(struct raid_set *rs)
/* raid5 with parity N -> raid6 with parity N */
/* raid5 with parity N -> raid6 with parity N */
if
(
mddev
->
new_level
==
6
&&
if
(
mddev
->
new_level
==
6
&&
((
mddev
->
layout
==
ALGORITHM_PARITY_N
&&
mddev
->
new_layout
==
ALGORITHM_PARITY_N
)
||
((
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
;
return
0
;
break
;
break
;
...
@@ -1495,7 +1495,7 @@ static int rs_check_takeover(struct raid_set *rs)
...
@@ -1495,7 +1495,7 @@ static int rs_check_takeover(struct raid_set *rs)
/* raid6_*_n with parity N -> raid5_* */
/* raid6_*_n with parity N -> raid5_* */
if
(
mddev
->
new_level
==
5
&&
if
(
mddev
->
new_level
==
5
&&
((
mddev
->
layout
==
ALGORITHM_PARITY_N
&&
mddev
->
new_layout
==
ALGORITHM_PARITY_N
)
||
((
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
;
return
0
;
default:
default:
...
@@ -2291,7 +2291,7 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
...
@@ -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
))
if
(
dm_read_arg
(
_args
+
1
,
&
as_nrd
,
&
num_raid_devs
,
&
ti
->
error
))
return
-
EINVAL
;
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"
;
ti
->
error
=
"Invalid number of supplied raid devices"
;
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment