summaryrefslogtreecommitdiffstats
path: root/Build.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2005-10-11 04:44:44 +0000
committerNeil Brown <neilb@suse.de>2005-10-11 04:44:44 +0000
commitdcec9ee54779586f287f5db98ab1be3f0f02dd3f (patch)
tree053ff57337183f7b975433ad45f74a8cb245cdf9 /Build.c
parent5a6d7f456ad67779321d8aa81203f70bcc56a0a5 (diff)
downloadmdadm-dcec9ee54779586f287f5db98ab1be3f0f02dd3f.tar.gz
mdadm-dcec9ee54779586f287f5db98ab1be3f0f02dd3f.tar.xz
mdadm-dcec9ee54779586f287f5db98ab1be3f0f02dd3f.zip
Create version-4 bitmaps if kernel supports it.
Version-3 bitmaps are host-endian. Version-4 are little-endian and so more portable. Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'Build.c')
-rw-r--r--Build.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Build.c b/Build.c
index 689aad0..2fcc47e 100644
--- 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);