diff options
author | NeilBrown <neilb@suse.de> | 2012-05-30 05:08:39 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-05-30 05:08:39 +0200 |
commit | 2c096ebe4b8f38faf701286852dbfd5939cfee47 (patch) | |
tree | 5ba4063aa3a2165f139a8fe18cd844c1cdb2f7da /Detail.c | |
parent | New tests testing removal of internal bitmaps (diff) | |
download | mdadm-2c096ebe4b8f38faf701286852dbfd5939cfee47.tar.xz mdadm-2c096ebe4b8f38faf701286852dbfd5939cfee47.zip |
Detail: show which 'set' each device in a RAID10 belongs to
A RAID10 can be though of as having 2 sets of devices
(if there are 2 copies and an even number of devices in total).
With this patch "mdadm --detail" shows which 'set' each device
belongs to - set-A or set-B.
If there are more than 3 copies, there can be more than 3 sets.
If the number of copies does not evenly divide the number of devices,
there are not distinct 'sets' so none are reported.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Detail.c')
-rw-r--r-- | Detail.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -533,7 +533,19 @@ This is pretty boring failed++; } if (disk.state & (1<<MD_DISK_ACTIVE)) printf(" active"); - if (disk.state & (1<<MD_DISK_SYNC)) printf(" sync"); + if (disk.state & (1<<MD_DISK_SYNC)) { + printf(" sync"); + if (array.level == 10 && (array.layout & ~0x1FFFF) == 0) { + int nc = array.layout & 0xff; + int fc = (array.layout >> 8) & 0xff; + int copies = nc*fc; + if (array.raid_disks % copies == 0 && copies <= 26) { + /* We can divide the devices into 'sets' */ + int set = disk.raid_disk % copies; + printf(" set-%c", set + 'A'); + } + } + } if (disk.state & (1<<MD_DISK_REMOVED)) printf(" removed"); if (disk.state & (1<<MD_DISK_WRITEMOSTLY)) printf(" writemostly"); if ((disk.state & |