]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Build.c
Create version-4 bitmaps if kernel supports it.
[thirdparty/mdadm.git] / Build.c
diff --git a/Build.c b/Build.c
index 689aad0e7344cbe1320106e105f8071017fd7443..2fcc47e153f2d3c29c428cf308d27fe966a747f2 100644 (file)
--- a/Build.c
+++ b/Build.c
@@ -202,13 +202,21 @@ int Build(char *mddev, int mdfd, int chunk, int level, int layout,
                if (bitmap_file) {
                        bitmap_fd = open(bitmap_file, O_RDWR);
                        if (bitmap_fd < 0) {
+                               int major = BITMAP_MAJOR_HI;
                                if (bitmap_chunk == UnSet) {
                                        fprintf(stderr, Name ": %s cannot be openned.",
                                                bitmap_file);
                                        return 1;
                                }
+                               if (vers < 9003) {
+                                       major = BITMAP_MAJOR_HOSTENDIAN;
+#ifdef __BIG_ENDIAN
+                                       fprintf(stderr, Name ": Warning - bitmaps created on this kernel are not portable\n"
+                                               "  between different architectured.  Consider upgrading the Linux kernel.\n");
+#endif
+                               }
                                if (CreateBitmap(bitmap_file, 1, NULL, bitmap_chunk,
-                                                delay, write_behind, size>>9)) {
+                                                delay, write_behind, size>>9, major)) {
                                        return 1;
                                }
                                bitmap_fd = open(bitmap_file, O_RDWR);