#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! */
#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)
/*
}
/*
- * 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 */
}
/* 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) ||
}
/*
- * 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 */
else if (rt_is_raid6(rs->raid_type))
return RAID6_VALID_FLAGS;
- return ~0;
+ return 0;
}
/*
}
/* 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;
}
/* 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 */
/* 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) {
}
}
- return 0;
+ return false;
}
/* Return raid_type for @name */