aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-raid.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-02 20:02:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-02 20:02:37 -0400
commit43672a0784707d795556b1f93925da8b8e797d03 (patch)
tree5c92aabd211281300f89fc2e69e9ee7e58bcc449 /drivers/md/dm-raid.c
parent2380078cdb7e6d520e33dcf834e0be979d542e48 (diff)
parent2e727c3ca1beff05f27b6207a795790f222bf8d8 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/linux-dm
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/linux-dm: dm: raid fix device status indicator when array initializing dm log userspace: add log device dependency dm log userspace: fix comment hyphens dm: add thin provisioning target dm: add persistent data library dm: add bufio dm: export dm get md dm table: add immutable feature dm table: add always writeable feature dm table: add singleton feature dm kcopyd: add dm_kcopyd_zero to zero an area dm: remove superfluous smp_mb dm: use local printk ratelimit dm table: propagate non rotational flag
Diffstat (limited to 'drivers/md/dm-raid.c')
-rw-r--r--drivers/md/dm-raid.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 37a37266a1e3..11fa96df4b06 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -1017,30 +1017,56 @@ static int raid_status(struct dm_target *ti, status_type_t type,
1017 struct raid_set *rs = ti->private; 1017 struct raid_set *rs = ti->private;
1018 unsigned raid_param_cnt = 1; /* at least 1 for chunksize */ 1018 unsigned raid_param_cnt = 1; /* at least 1 for chunksize */
1019 unsigned sz = 0; 1019 unsigned sz = 0;
1020 int i; 1020 int i, array_in_sync = 0;
1021 sector_t sync; 1021 sector_t sync;
1022 1022
1023 switch (type) { 1023 switch (type) {
1024 case STATUSTYPE_INFO: 1024 case STATUSTYPE_INFO:
1025 DMEMIT("%s %d ", rs->raid_type->name, rs->md.raid_disks); 1025 DMEMIT("%s %d ", rs->raid_type->name, rs->md.raid_disks);
1026 1026
1027 for (i = 0; i < rs->md.raid_disks; i++) {
1028 if (test_bit(Faulty, &rs->dev[i].rdev.flags))
1029 DMEMIT("D");
1030 else if (test_bit(In_sync, &rs->dev[i].rdev.flags))
1031 DMEMIT("A");
1032 else
1033 DMEMIT("a");
1034 }
1035
1036 if (test_bit(MD_RECOVERY_RUNNING, &rs->md.recovery)) 1027 if (test_bit(MD_RECOVERY_RUNNING, &rs->md.recovery))
1037 sync = rs->md.curr_resync_completed; 1028 sync = rs->md.curr_resync_completed;
1038 else 1029 else
1039 sync = rs->md.recovery_cp; 1030 sync = rs->md.recovery_cp;
1040 1031
1041 if (sync > rs->md.resync_max_sectors) 1032 if (sync >= rs->md.resync_max_sectors) {
1033 array_in_sync = 1;
1042 sync = rs->md.resync_max_sectors; 1034 sync = rs->md.resync_max_sectors;
1035 } else {
1036 /*
1037 * The array may be doing an initial sync, or it may
1038 * be rebuilding individual components. If all the
1039 * devices are In_sync, then it is the array that is
1040 * being initialized.
1041 */
1042 for (i = 0; i < rs->md.raid_disks; i++)
1043 if (!test_bit(In_sync, &rs->dev[i].rdev.flags))
1044 array_in_sync = 1;
1045 }
1046 /*
1047 * Status characters:
1048 * 'D' = Dead/Failed device
1049 * 'a' = Alive but not in-sync
1050 * 'A' = Alive and in-sync
1051 */
1052 for (i = 0; i < rs->md.raid_disks; i++) {
1053 if (test_bit(Faulty, &rs->dev[i].rdev.flags))
1054 DMEMIT("D");
1055 else if (!array_in_sync ||
1056 !test_bit(In_sync, &rs->dev[i].rdev.flags))
1057 DMEMIT("a");
1058 else
1059 DMEMIT("A");
1060 }
1043 1061
1062 /*
1063 * In-sync ratio:
1064 * The in-sync ratio shows the progress of:
1065 * - Initializing the array
1066 * - Rebuilding a subset of devices of the array
1067 * The user can distinguish between the two by referring
1068 * to the status characters.
1069 */
1044 DMEMIT(" %llu/%llu", 1070 DMEMIT(" %llu/%llu",
1045 (unsigned long long) sync, 1071 (unsigned long long) sync,
1046 (unsigned long long) rs->md.resync_max_sectors); 1072 (unsigned long long) rs->md.resync_max_sectors);