提交 552aa679 编写于 作者: H Heinz Mauelshagen 提交者: Mike Snitzer

dm raid: use rs_is_raid*()

Cleanup, no functional change.
Signed-off-by: NHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
上级 7c29744e
...@@ -588,7 +588,7 @@ static const char *raid10_md_layout_to_format(int layout) ...@@ -588,7 +588,7 @@ static const char *raid10_md_layout_to_format(int layout)
} }
/* Return md raid10 algorithm for @name */ /* Return md raid10 algorithm for @name */
static int raid10_name_to_format(const char *name) static const int raid10_name_to_format(const char *name)
{ {
if (!strcasecmp(name, "near")) if (!strcasecmp(name, "near"))
return ALGORITHM_RAID10_NEAR; return ALGORITHM_RAID10_NEAR;
...@@ -1913,7 +1913,7 @@ static bool rs_reshape_requested(struct raid_set *rs) ...@@ -1913,7 +1913,7 @@ static bool rs_reshape_requested(struct raid_set *rs)
if (rs_takeover_requested(rs)) if (rs_takeover_requested(rs))
return false; return false;
if (!mddev->level) if (rs_is_raid0(rs))
return false; return false;
change = mddev->new_layout != mddev->layout || change = mddev->new_layout != mddev->layout ||
...@@ -1921,7 +1921,7 @@ static bool rs_reshape_requested(struct raid_set *rs) ...@@ -1921,7 +1921,7 @@ static bool rs_reshape_requested(struct raid_set *rs)
rs->delta_disks; rs->delta_disks;
/* Historical case to support raid1 reshape without delta disks */ /* Historical case to support raid1 reshape without delta disks */
if (mddev->level == 1) { if (rs_is_raid1(rs)) {
if (rs->delta_disks) if (rs->delta_disks)
return !!rs->delta_disks; return !!rs->delta_disks;
...@@ -1929,7 +1929,7 @@ static bool rs_reshape_requested(struct raid_set *rs) ...@@ -1929,7 +1929,7 @@ static bool rs_reshape_requested(struct raid_set *rs)
mddev->raid_disks != rs->raid_disks; mddev->raid_disks != rs->raid_disks;
} }
if (mddev->level == 10) if (rs_is_raid10(rs))
return change && return change &&
!__is_raid10_far(mddev->new_layout) && !__is_raid10_far(mddev->new_layout) &&
rs->delta_disks >= 0; rs->delta_disks >= 0;
...@@ -2742,14 +2742,14 @@ static int rs_setup_takeover(struct raid_set *rs) ...@@ -2742,14 +2742,14 @@ static int rs_setup_takeover(struct raid_set *rs)
sector_t new_data_offset = rs->dev[0].rdev.data_offset ? 0 : rs->data_offset; sector_t new_data_offset = rs->dev[0].rdev.data_offset ? 0 : rs->data_offset;
if (rt_is_raid10(rs->raid_type)) { if (rt_is_raid10(rs->raid_type)) {
if (mddev->level == 0) { if (rs_is_raid0(rs)) {
/* Userpace reordered disks -> adjust raid_disk indexes */ /* Userpace reordered disks -> adjust raid_disk indexes */
__reorder_raid_disk_indexes(rs); __reorder_raid_disk_indexes(rs);
/* raid0 -> raid10_far layout */ /* raid0 -> raid10_far layout */
mddev->layout = raid10_format_to_md_layout(rs, ALGORITHM_RAID10_FAR, mddev->layout = raid10_format_to_md_layout(rs, ALGORITHM_RAID10_FAR,
rs->raid10_copies); rs->raid10_copies);
} else if (mddev->level == 1) } else if (rs_is_raid1(rs))
/* raid1 -> raid10_near layout */ /* raid1 -> raid10_near layout */
mddev->layout = raid10_format_to_md_layout(rs, ALGORITHM_RAID10_NEAR, mddev->layout = raid10_format_to_md_layout(rs, ALGORITHM_RAID10_NEAR,
rs->raid_disks); rs->raid_disks);
...@@ -2977,7 +2977,7 @@ static void configure_discard_support(struct raid_set *rs) ...@@ -2977,7 +2977,7 @@ static void configure_discard_support(struct raid_set *rs)
/* /*
* XXX: RAID level 4,5,6 require zeroing for safety. * XXX: RAID level 4,5,6 require zeroing for safety.
*/ */
raid456 = (rs->md.level == 4 || rs->md.level == 5 || rs->md.level == 6); raid456 = rs_is_raid456(rs);
for (i = 0; i < rs->raid_disks; i++) { for (i = 0; i < rs->raid_disks; i++) {
struct request_queue *q; struct request_queue *q;
...@@ -3002,7 +3002,7 @@ static void configure_discard_support(struct raid_set *rs) ...@@ -3002,7 +3002,7 @@ static void configure_discard_support(struct raid_set *rs)
* RAID1 and RAID10 personalities require bio splitting, * RAID1 and RAID10 personalities require bio splitting,
* RAID0/4/5/6 don't and process large discard bios properly. * RAID0/4/5/6 don't and process large discard bios properly.
*/ */
ti->split_discard_bios = !!(rs->md.level == 1 || rs->md.level == 10); ti->split_discard_bios = !!(rs_is_raid1(rs) || rs_is_raid10(rs));
ti->num_discard_bios = 1; ti->num_discard_bios = 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册