Skip to content

Commit

Permalink
dm raid: use rs_is_raid*()
Browse files Browse the repository at this point in the history
Cleanup, no functional change.

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Heinz Mauelshagen authored and Mike Snitzer committed Dec 13, 2017
1 parent 7c29744 commit 552aa67
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/md/dm-raid.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ static const char *raid10_md_layout_to_format(int layout)
}

/* 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"))
return ALGORITHM_RAID10_NEAR;
Expand Down Expand Up @@ -1913,23 +1913,23 @@ static bool rs_reshape_requested(struct raid_set *rs)
if (rs_takeover_requested(rs))
return false;

if (!mddev->level)
if (rs_is_raid0(rs))
return false;

change = mddev->new_layout != mddev->layout ||
mddev->new_chunk_sectors != mddev->chunk_sectors ||
rs->delta_disks;

/* Historical case to support raid1 reshape without delta disks */
if (mddev->level == 1) {
if (rs_is_raid1(rs)) {
if (rs->delta_disks)
return !!rs->delta_disks;

return !change &&
mddev->raid_disks != rs->raid_disks;
}

if (mddev->level == 10)
if (rs_is_raid10(rs))
return change &&
!__is_raid10_far(mddev->new_layout) &&
rs->delta_disks >= 0;
Expand Down Expand Up @@ -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;

if (rt_is_raid10(rs->raid_type)) {
if (mddev->level == 0) {
if (rs_is_raid0(rs)) {
/* Userpace reordered disks -> adjust raid_disk indexes */
__reorder_raid_disk_indexes(rs);

/* raid0 -> raid10_far layout */
mddev->layout = raid10_format_to_md_layout(rs, ALGORITHM_RAID10_FAR,
rs->raid10_copies);
} else if (mddev->level == 1)
} else if (rs_is_raid1(rs))
/* raid1 -> raid10_near layout */
mddev->layout = raid10_format_to_md_layout(rs, ALGORITHM_RAID10_NEAR,
rs->raid_disks);
Expand Down Expand Up @@ -2977,7 +2977,7 @@ static void configure_discard_support(struct raid_set *rs)
/*
* 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++) {
struct request_queue *q;
Expand All @@ -3002,7 +3002,7 @@ static void configure_discard_support(struct raid_set *rs)
* RAID1 and RAID10 personalities require bio splitting,
* 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;
}

Expand Down

0 comments on commit 552aa67

Please sign in to comment.