summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2005-06-07 23:16:36 +0000
committerNeil Brown <neilb@suse.de>2005-06-07 23:16:36 +0000
commit570c05424705e5f9740567b3683a8d45b7a765f6 (patch)
tree12c4990153401b3079b3564ab85b0508b3cb8c39 /util.c
parent024ce7fe2b6d06dc669d0b675a49c02910853a44 (diff)
downloadmdadm-570c05424705e5f9740567b3683a8d45b7a765f6.tar.gz
mdadm-570c05424705e5f9740567b3683a8d45b7a765f6.tar.xz
mdadm-570c05424705e5f9740567b3683a8d45b7a765f6.zip
Release 1.8.1 after some man page updates and other fixes.mdadm-1.11.1
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Diffstat (limited to 'util.c')
-rw-r--r--util.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/util.c b/util.c
index bb4a479..010764e 100644
--- a/util.c
+++ b/util.c
@@ -386,6 +386,15 @@ unsigned long calc_csum(void *super, int bytes)
for(i=0; i<bytes/4; i++)
newcsum+= superc[i];
csum = (newcsum& 0xffffffff) + (newcsum>>32);
+#ifdef __alpha__
+/* The in-kernel checksum calculation is always 16bit on
+ * the alpha, though it is 32 bit on i386...
+ * I wonder what it is elsewhere... (it uses and API in
+ * a way that it shouldn't).
+ */
+ csum = (csum & 0xffff) + (csum >> 16);
+ csum = (csum & 0xffff) + (csum >> 16);
+#endif
return csum;
}
@@ -544,6 +553,8 @@ struct supertype *guess_super(int fd)
*/
struct superswitch *ss;
struct supertype *st;
+ unsigned long besttime = 0;
+ int bestsuper = -1;
void *sbp = NULL;
int i;
@@ -555,9 +566,25 @@ struct supertype *guess_super(int fd)
ss = superlist[i];
rv = ss->load_super(st, fd, &sbp, NULL);
if (rv == 0) {
+ struct mdinfo info;
+ ss->getinfo_super(&info, sbp);
+ if (bestsuper == -1 ||
+ besttime < info.array.ctime) {
+ bestsuper = i;
+ besttime = info.array.ctime;
+ st->ss = NULL;
+ }
+ free(sbp);
+ }
+ }
+ if (bestsuper != -1) {
+ int rv;
+ rv = superlist[bestsuper]->load_super(st, fd, &sbp, NULL);
+ if (rv == 0) {
free(sbp);
return st;
}
}
+ free(st);
return NULL;
}