@@ -84,6 +84,7 @@ static loff_t lov_tgt_maxbytes(struct lov_tgt_desc *tgt)
static int lsm_lmm_verify_v1v3(struct lov_mds_md *lmm, size_t lmm_size,
u16 stripe_count)
{
+ u32 pattern = le32_to_cpu(lmm->lmm_pattern);
int rc = 0;
if (stripe_count > LOV_V1_INSANE_STRIPE_COUNT) {
@@ -101,10 +102,7 @@ static int lsm_lmm_verify_v1v3(struct lov_mds_md *lmm, size_t lmm_size,
goto out;
}
- if (lov_pattern(le32_to_cpu(lmm->lmm_pattern)) != LOV_PATTERN_MDT &&
- lov_pattern(le32_to_cpu(lmm->lmm_pattern)) != LOV_PATTERN_RAID0 &&
- lov_pattern(le32_to_cpu(lmm->lmm_pattern)) !=
- (LOV_PATTERN_RAID0 | LOV_PATTERN_OVERSTRIPING)) {
+ if (!lov_pattern_supported(lov_pattern(pattern))) {
rc = -EINVAL;
CERROR("lov: unrecognized striping pattern: rc = %d\n", rc);
lov_dump_lmm_common(D_WARNING, lmm);
@@ -443,6 +443,14 @@ static inline bool lov_pattern_supported_normal_comp(__u32 pattern)
#define LOV_OFFSET_DEFAULT ((__u16)-1)
#define LMV_OFFSET_DEFAULT ((__u32)-1)
+static inline bool lov_pattern_supported(__u32 pattern)
+{
+ return (pattern & ~LOV_PATTERN_F_RELEASED) == LOV_PATTERN_RAID0 ||
+ (pattern & ~LOV_PATTERN_F_RELEASED) ==
+ (LOV_PATTERN_RAID0 | LOV_PATTERN_OVERSTRIPING) ||
+ (pattern & ~LOV_PATTERN_F_RELEASED) == LOV_PATTERN_MDT;
+}
+
#define LOV_MIN_STRIPE_BITS 16 /* maximum PAGE_SIZE (ia64), power of 2 */
#define LOV_MIN_STRIPE_SIZE (1 << LOV_MIN_STRIPE_BITS)
#define LOV_MAX_STRIPE_COUNT_OLD 160