aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan E Brassow <jbrassow@redhat.com>2007-05-09 05:32:58 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 15:30:47 -0400
commit315dcc226f066c1d3cef79283dcde807fe0e32d1 (patch)
treef3abf75905aec13819292564ef4c2711c8bf4b8d
parent01d03a660e73fb524957c09825a3eb7c2ae7c205 (diff)
dm log: report fault status
This patch reports the status of the log device so that userspace can detect the error and take appropriate action. Signed-off-by: Jonathan E Brassow <jbrassow@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/md/dm-log.c7
-rw-r--r--drivers/md/dm-raid1.c11
2 files changed, 11 insertions, 7 deletions
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index a503d12c2ff8..8d301409d814 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -615,6 +615,7 @@ static int core_status(struct dirty_log *log, status_type_t status,
615 615
616 switch(status) { 616 switch(status) {
617 case STATUSTYPE_INFO: 617 case STATUSTYPE_INFO:
618 DMEMIT("1 %s", log->type->name);
618 break; 619 break;
619 620
620 case STATUSTYPE_TABLE: 621 case STATUSTYPE_TABLE:
@@ -630,17 +631,17 @@ static int disk_status(struct dirty_log *log, status_type_t status,
630 char *result, unsigned int maxlen) 631 char *result, unsigned int maxlen)
631{ 632{
632 int sz = 0; 633 int sz = 0;
633 char buffer[16];
634 struct log_c *lc = log->context; 634 struct log_c *lc = log->context;
635 635
636 switch(status) { 636 switch(status) {
637 case STATUSTYPE_INFO: 637 case STATUSTYPE_INFO:
638 DMEMIT("3 %s %s %c", log->type->name, lc->log_dev->name,
639 lc->log_dev_failed ? 'D' : 'A');
638 break; 640 break;
639 641
640 case STATUSTYPE_TABLE: 642 case STATUSTYPE_TABLE:
641 format_dev_t(buffer, lc->log_dev->bdev->bd_dev);
642 DMEMIT("%s %u %s %u ", log->type->name, 643 DMEMIT("%s %u %s %u ", log->type->name,
643 lc->sync == DEFAULTSYNC ? 2 : 3, buffer, 644 lc->sync == DEFAULTSYNC ? 2 : 3, lc->log_dev->name,
644 lc->region_size); 645 lc->region_size);
645 DMEMIT_SYNC; 646 DMEMIT_SYNC;
646 } 647 }
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index c8b4c108da9e..cb3f318a3692 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -1205,11 +1205,9 @@ static void mirror_resume(struct dm_target *ti)
1205static int mirror_status(struct dm_target *ti, status_type_t type, 1205static int mirror_status(struct dm_target *ti, status_type_t type,
1206 char *result, unsigned int maxlen) 1206 char *result, unsigned int maxlen)
1207{ 1207{
1208 unsigned int m, sz; 1208 unsigned int m, sz = 0;
1209 struct mirror_set *ms = (struct mirror_set *) ti->private; 1209 struct mirror_set *ms = (struct mirror_set *) ti->private;
1210 1210
1211 sz = ms->rh.log->type->status(ms->rh.log, type, result, maxlen);
1212
1213 switch (type) { 1211 switch (type) {
1214 case STATUSTYPE_INFO: 1212 case STATUSTYPE_INFO:
1215 DMEMIT("%d ", ms->nr_mirrors); 1213 DMEMIT("%d ", ms->nr_mirrors);
@@ -1220,9 +1218,14 @@ static int mirror_status(struct dm_target *ti, status_type_t type,
1220 (unsigned long long)ms->rh.log->type-> 1218 (unsigned long long)ms->rh.log->type->
1221 get_sync_count(ms->rh.log), 1219 get_sync_count(ms->rh.log),
1222 (unsigned long long)ms->nr_regions); 1220 (unsigned long long)ms->nr_regions);
1221
1222 sz = ms->rh.log->type->status(ms->rh.log, type, result, maxlen);
1223
1223 break; 1224 break;
1224 1225
1225 case STATUSTYPE_TABLE: 1226 case STATUSTYPE_TABLE:
1227 sz = ms->rh.log->type->status(ms->rh.log, type, result, maxlen);
1228
1226 DMEMIT("%d", ms->nr_mirrors); 1229 DMEMIT("%d", ms->nr_mirrors);
1227 for (m = 0; m < ms->nr_mirrors; m++) 1230 for (m = 0; m < ms->nr_mirrors; m++)
1228 DMEMIT(" %s %llu", ms->mirror[m].dev->name, 1231 DMEMIT(" %s %llu", ms->mirror[m].dev->name,
@@ -1234,7 +1237,7 @@ static int mirror_status(struct dm_target *ti, status_type_t type,
1234 1237
1235static struct target_type mirror_target = { 1238static struct target_type mirror_target = {
1236 .name = "mirror", 1239 .name = "mirror",
1237 .version = {1, 0, 2}, 1240 .version = {1, 0, 3},
1238 .module = THIS_MODULE, 1241 .module = THIS_MODULE,
1239 .ctr = mirror_ctr, 1242 .ctr = mirror_ctr,
1240 .dtr = mirror_dtr, 1243 .dtr = mirror_dtr,