dm log: report fault status
authorJonathan E Brassow <jbrassow@redhat.com>
Wed, 9 May 2007 09:32:58 +0000 (02:32 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 9 May 2007 19:30:47 +0000 (12:30 -0700)
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>
drivers/md/dm-log.c
drivers/md/dm-raid1.c

index a503d12c2ff84e8b5c5dadfe94094f5178b21c5f..8d301409d8142691a41205df562ee57cf88dfa7e 100644 (file)
@@ -615,6 +615,7 @@ static int core_status(struct dirty_log *log, status_type_t status,
 
        switch(status) {
        case STATUSTYPE_INFO:
+               DMEMIT("1 %s", log->type->name);
                break;
 
        case STATUSTYPE_TABLE:
@@ -630,17 +631,17 @@ static int disk_status(struct dirty_log *log, status_type_t status,
                       char *result, unsigned int maxlen)
 {
        int sz = 0;
-       char buffer[16];
        struct log_c *lc = log->context;
 
        switch(status) {
        case STATUSTYPE_INFO:
+               DMEMIT("3 %s %s %c", log->type->name, lc->log_dev->name,
+                      lc->log_dev_failed ? 'D' : 'A');
                break;
 
        case STATUSTYPE_TABLE:
-               format_dev_t(buffer, lc->log_dev->bdev->bd_dev);
                DMEMIT("%s %u %s %u ", log->type->name,
-                      lc->sync == DEFAULTSYNC ? 2 : 3, buffer,
+                      lc->sync == DEFAULTSYNC ? 2 : 3, lc->log_dev->name,
                       lc->region_size);
                DMEMIT_SYNC;
        }
index c8b4c108da9ee47d1084d3bce5a16d62852fa7fb..cb3f318a36921597bd82ef9c0700220c15e93583 100644 (file)
@@ -1205,11 +1205,9 @@ static void mirror_resume(struct dm_target *ti)
 static int mirror_status(struct dm_target *ti, status_type_t type,
                         char *result, unsigned int maxlen)
 {
-       unsigned int m, sz;
+       unsigned int m, sz = 0;
        struct mirror_set *ms = (struct mirror_set *) ti->private;
 
-       sz = ms->rh.log->type->status(ms->rh.log, type, result, maxlen);
-
        switch (type) {
        case STATUSTYPE_INFO:
                DMEMIT("%d ", ms->nr_mirrors);
@@ -1220,9 +1218,14 @@ static int mirror_status(struct dm_target *ti, status_type_t type,
                        (unsigned long long)ms->rh.log->type->
                                get_sync_count(ms->rh.log),
                        (unsigned long long)ms->nr_regions);
+
+               sz = ms->rh.log->type->status(ms->rh.log, type, result, maxlen);
+
                break;
 
        case STATUSTYPE_TABLE:
+               sz = ms->rh.log->type->status(ms->rh.log, type, result, maxlen);
+
                DMEMIT("%d", ms->nr_mirrors);
                for (m = 0; m < ms->nr_mirrors; m++)
                        DMEMIT(" %s %llu", ms->mirror[m].dev->name,
@@ -1234,7 +1237,7 @@ static int mirror_status(struct dm_target *ti, status_type_t type,
 
 static struct target_type mirror_target = {
        .name    = "mirror",
-       .version = {1, 0, 2},
+       .version = {1, 0, 3},
        .module  = THIS_MODULE,
        .ctr     = mirror_ctr,
        .dtr     = mirror_dtr,