/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
- * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
+ * Copyright (C) 2001-2009 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Neil Brown
- * Email: <neilb@cse.unsw.edu.au>
- * Paper: Neil Brown
- * School of Computer Science and Engineering
- * The University of New South Wales
- * Sydney, 2052
- * Australia
+ * Email: <neilb@suse.de>
*/
#include "mdadm.h"
disk.minor == 0)
continue;
if ((dv=map_dev(disk.major, disk.minor, 1))) {
- if ((!st || !st->sb) &&
+ /* some formats (imsm) have free-floating-spares
+ * with a uuid of uuid_match_any, they don't
+ * have very good info about the rest of the
+ * container, so keep searching when
+ * encountering such a device. Otherwise, stop
+ * after the first successful call to
+ * ->load_super.
+ */
+ int free_spare = memcmp(uuid_match_any,
+ info.uuid,
+ sizeof(uuid_match_any)) == 0;
+ if ((!st || !st->sb || free_spare) &&
(array.raid_disks == 0 ||
(disk.state & (1<<MD_DISK_ACTIVE)))) {
/* try to read the superblock from this device
* to get more info
*/
+ if (free_spare)
+ st->ss->free_super(st);
int fd2 = dev_open(dv, O_RDONLY);
if (fd2 >=0 && st &&
st->ss->load_super(st, fd2, NULL) == 0) {
if (brief) {
mdu_bitmap_file_t bmf;
- if (array.raid_disks)
- printf("ARRAY %s level=%s num-devices=%d", dev,
- c?c:"-unknown-",
- array.raid_disks );
- else
- printf("ARRAY %s level=container num-devices=%d",
- dev, array.nr_disks);
-
+ printf("ARRAY %s", dev);
+ if (brief > 1) {
+ if (array.raid_disks)
+ printf("level=%s num-devices=%d",
+ c?c:"-unknown-",
+ array.raid_disks );
+ else
+ printf("level=container num-devices=%d",
+ array.nr_disks);
+ }
if (container) {
printf(" container=%s", container);
printf(" member=%s", member);
unsigned long long dsize = get_component_size(fd);
if (dsize > 0)
printf(" Used Dev Size : %llu%s\n",
- dsize,
- human_size((long long)dsize<<10));
+ dsize/2,
+ human_size((long long)dsize<<9));
else
printf(" Used Dev Size : unknown\n");
} else
int err = 1;
if (ss && ss->detail_platform)
- err = ss->detail_platform(verbose);
+ err = ss->detail_platform(verbose, 0);
else if (ss) {
if (verbose)
fprintf(stderr, Name ": %s metadata is platform independent\n",
fprintf(stderr, Name ": %s metadata is platform independent\n",
meta->name ? : "[no name]");
} else
- err |= meta->detail_platform(verbose);
+ err |= meta->detail_platform(verbose, 0);
}
return err;