]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
Improve reporting of layout for raid10.
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 75f370644124351c6279d3a0b194d7416745604f..2d51de02ba4386ea3fae93a4cd41d7b7e998773b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -606,6 +606,23 @@ char *human_size_brief(long long bytes)
                        );
        return buf;
 }
                        );
        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)
 #endif
 
 #if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO)