Improve reporting of layout for raid10.
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 75f3706..2d51de0 100644 (file)
--- a/util.c
+++ b/util.c
@@ -606,6 +606,23 @@ char *human_size_brief(long long bytes)
                        );
        return buf;
 }
+
+void print_r10_layout(int layout)
+{
+       int near = layout & 255;
+       int far = (layout >> 8) & 255;
+       int offset = (layout&0x10000);
+       char *sep = "";
+
+       if (near != 1) {
+               printf("%s near=%d", sep, near);
+               sep = ",";
+       }
+       if (far != 1)
+               printf("%s %s=%d", sep, offset?"offset":"far", far);
+       if (near*far == 1)
+               printf("NO REDUNDANCY");
+}
 #endif
 
 #if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO)