Detail: show consistency policy

Show the currently enabled consistency policy in the output from
--detail. Add 3 spaces to all existing items in Detail output to align
with "Consistency Policy : ".

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
This commit is contained in:
Artur Paszkiewicz 2017-03-29 11:54:16 +02:00 committed by Jes Sorensen
parent 5308f11727
commit 65884368cd
5 changed files with 65 additions and 46 deletions

View File

@ -402,7 +402,8 @@ int Detail(char *dev, struct context *c)
printf("%s:\n", dev); printf("%s:\n", dev);
if (container) if (container)
printf(" Container : %s, member %s\n", container, member); printf(" Container : %s, member %s\n", container,
member);
else { else {
if (sra && sra->array.major_version < 0) if (sra && sra->array.major_version < 0)
printf(" Version : %s\n", sra->text_version); printf(" Version : %s\n", sra->text_version);
@ -444,7 +445,7 @@ int Detail(char *dev, struct context *c)
if (!container && if (!container &&
((sra == NULL && array.major_version == 0) || ((sra == NULL && array.major_version == 0) ||
(sra && sra->array.major_version == 0))) (sra && sra->array.major_version == 0)))
printf("Preferred Minor : %d\n", array.md_minor); printf(" Preferred Minor : %d\n", array.md_minor);
if (sra == NULL || sra->array.major_version >= 0) if (sra == NULL || sra->array.major_version >= 0)
printf(" Persistence : Superblock is %spersistent\n", printf(" Persistence : Superblock is %spersistent\n",
array.not_persistent?"not ":""); array.not_persistent?"not ":"");
@ -486,7 +487,7 @@ int Detail(char *dev, struct context *c)
if (array.raid_disks) if (array.raid_disks)
printf(" Active Devices : %d\n", array.active_disks); printf(" Active Devices : %d\n", array.active_disks);
if (array.working_disks > 0) if (array.working_disks > 0)
printf("Working Devices : %d\n", array.working_disks); printf(" Working Devices : %d\n", array.working_disks);
if (array.raid_disks) { if (array.raid_disks) {
printf(" Failed Devices : %d\n", array.failed_disks); printf(" Failed Devices : %d\n", array.failed_disks);
printf(" Spare Devices : %d\n", array.spare_disks); printf(" Spare Devices : %d\n", array.spare_disks);
@ -516,16 +517,31 @@ int Detail(char *dev, struct context *c)
array.chunk_size/1024); array.chunk_size/1024);
break; break;
case -1: case -1:
printf(" Rounding : %dK\n\n", array.chunk_size/1024); printf(" Rounding : %dK\n\n",
array.chunk_size/1024);
break; break;
default: break; default: break;
} }
if (array.raid_disks) {
struct mdinfo *mdi = sysfs_read(fd, NULL,
GET_CONSISTENCY_POLICY);
if (mdi) {
char *policy = map_num(consistency_policies,
mdi->consistency_policy);
sysfs_free(mdi);
if (policy)
printf("Consistency Policy : %s\n\n",
policy);
}
}
if (e && e->percent >= 0) { if (e && e->percent >= 0) {
static char *sync_action[] = { static char *sync_action[] = {
"Rebuild", "Resync", "Rebuild", "Resync",
"Reshape", "Check"}; "Reshape", "Check"};
printf(" %7s Status : %d%% complete\n", sync_action[e->resync], e->percent); printf(" %7s Status : %d%% complete\n",
sync_action[e->resync], e->percent);
is_rebuilding = 1; is_rebuilding = 1;
} }
free_mdstat(ms); free_mdstat(ms);
@ -533,7 +549,8 @@ int Detail(char *dev, struct context *c)
if ((st && st->sb) && (info && info->reshape_active)) { if ((st && st->sb) && (info && info->reshape_active)) {
#if 0 #if 0
This is pretty boring This is pretty boring
printf(" Reshape pos'n : %llu%s\n", (unsigned long long) info->reshape_progress<<9, printf(" Reshape pos'n : %llu%s\n",
(unsigned long long) info->reshape_progress<<9,
human_size((unsigned long long)info->reshape_progress<<9)); human_size((unsigned long long)info->reshape_progress<<9));
#endif #endif
if (info->delta_disks != 0) if (info->delta_disks != 0)
@ -565,7 +582,8 @@ This is pretty boring
} }
} }
if (info->new_chunk != array.chunk_size) if (info->new_chunk != array.chunk_size)
printf(" New Chunksize : %dK\n", info->new_chunk/1024); printf(" New Chunksize : %dK\n",
info->new_chunk/1024);
printf("\n"); printf("\n");
} else if (e && e->percent >= 0) } else if (e && e->percent >= 0)
printf("\n"); printf("\n");

View File

@ -792,7 +792,8 @@ static void detail_super1(struct supertype *st, char *homehost)
if ((i&3)==0 && i != 0) printf(":"); if ((i&3)==0 && i != 0) printf(":");
printf("%02x", sb->set_uuid[i]); printf("%02x", sb->set_uuid[i]);
} }
printf("\n Events : %llu\n\n", (unsigned long long)__le64_to_cpu(sb->events)); printf("\n Events : %llu\n\n",
(unsigned long long)__le64_to_cpu(sb->events));
} }
static void brief_detail_super1(struct supertype *st) static void brief_detail_super1(struct supertype *st)