summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHeinz Mauelshagen <heinzm@redhat.com>2016-07-06 18:29:22 +0200
committerMike Snitzer <snitzer@redhat.com>2016-07-18 21:37:33 +0200
commitd7ccc2e2a0e5a4cdd024f4a1349a033f7cd3aa7d (patch)
treebea8ea763033a034595853fcf08a4611e0b71bf1 /drivers
parentdm raid: use rdev_for_each in status (diff)
downloadlinux-d7ccc2e2a0e5a4cdd024f4a1349a033f7cd3aa7d.tar.xz
linux-d7ccc2e2a0e5a4cdd024f4a1349a033f7cd3aa7d.zip
dm raid: change logical functions to actually return bool
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-raid.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index e4d0bc185c99..0aaf4ef7152c 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -69,7 +69,7 @@ struct raid_dev {
#define __CTR_FLAG_RAID10_COPIES 10 /* 2 */ /* Only with raid10 */
#define __CTR_FLAG_RAID10_FORMAT 11 /* 2 */ /* Only with raid10 */
/* New for v1.9.0 */
-#define __CTR_FLAG_DELTA_DISKS 12 /* 2 */ /* Only with reshapable raid4/5/6/10! */
+#define __CTR_FLAG_DELTA_DISKS 12 /* 2 */ /* Only with reshapable raid1/4/5/6/10! */
#define __CTR_FLAG_DATA_OFFSET 13 /* 2 */ /* Only with reshapable raid4/5/6/10! */
#define __CTR_FLAG_RAID10_USE_NEAR_SETS 14 /* 2 */ /* Only with raid10! */
@@ -193,7 +193,7 @@ struct raid_dev {
#define RT_FLAG_RESHAPE_RS 4
#define RT_FLAG_KEEP_RS_FROZEN 5
-/* Array elements of 64 bit needed for rebuild/write_mostly bits */
+/* Array elements of 64 bit needed for rebuild/failed disk bits */
#define DISKS_ARRAY_ELEMS ((MAX_RAID_DEVICES + (sizeof(uint64_t) * 8 - 1)) / sizeof(uint64_t) / 8)
/*
@@ -328,8 +328,8 @@ static const char *dm_raid_arg_name_by_flag(const uint32_t flag)
}
/*
- * bool helpers to test for various raid levels of a raid set,
- * is. it's level as reported by the superblock rather than
+ * Bool helpers to test for various raid levels of a raid set.
+ * It's level as reported by the superblock rather than
* the requested raid_type passed to the constructor.
*/
/* Return true, if raid set in @rs is raid0 */
@@ -363,7 +363,7 @@ static bool rs_is_raid456(struct raid_set *rs)
}
/* Return true, if raid set in @rs is reshapable */
-static unsigned int __is_raid10_far(int layout);
+static bool __is_raid10_far(int layout);
static bool rs_is_reshapable(struct raid_set *rs)
{
return rs_is_raid456(rs) ||
@@ -383,7 +383,7 @@ static bool rs_is_reshaping(struct raid_set *rs)
}
/*
- * bool helpers to test for various raid levels of a raid type
+ * bool helpers to test for various raid levels of a raid type @rt
*/
/* Return true, if raid type in @rt is raid0 */
@@ -437,7 +437,7 @@ static unsigned long __valid_flags(struct raid_set *rs)
else if (rt_is_raid6(rs->raid_type))
return RAID6_VALID_FLAGS;
- return ~0;
+ return 0;
}
/*
@@ -474,19 +474,19 @@ static unsigned int __raid10_far_copies(int layout)
}
/* Return true if md raid10 offset for @layout */
-static unsigned int __is_raid10_offset(int layout)
+static bool __is_raid10_offset(int layout)
{
- return layout & RAID10_OFFSET;
+ return !!(layout & RAID10_OFFSET);
}
/* Return true if md raid10 near for @layout */
-static unsigned int __is_raid10_near(int layout)
+static bool __is_raid10_near(int layout)
{
return !__is_raid10_offset(layout) && __raid10_near_copies(layout) > 1;
}
/* Return true if md raid10 far for @layout */
-static unsigned int __is_raid10_far(int layout)
+static bool __is_raid10_far(int layout)
{
return !__is_raid10_offset(layout) && __raid10_far_copies(layout) > 1;
}
@@ -527,8 +527,7 @@ static int raid10_name_to_format(const char *name)
/* Return md raid10 copies for @layout */
static unsigned int raid10_md_layout_to_copies(int layout)
{
- return __raid10_near_copies(layout) > 1 ?
- __raid10_near_copies(layout) : __raid10_far_copies(layout);
+ return max(__raid10_near_copies(layout), __raid10_far_copies(layout));
}
/* Return md raid10 format id for @format string */
@@ -570,7 +569,7 @@ static int raid10_format_to_md_layout(struct raid_set *rs,
/* END: MD raid10 bit definitions and helpers */
/* Check for any of the raid10 algorithms */
-static int __got_raid10(struct raid_type *rtp, const int layout)
+static bool __got_raid10(struct raid_type *rtp, const int layout)
{
if (rtp->level == 10) {
switch (rtp->algorithm) {
@@ -586,7 +585,7 @@ static int __got_raid10(struct raid_type *rtp, const int layout)
}
}
- return 0;
+ return false;
}
/* Return raid_type for @name */