]> sourceware.org Git - lvm2.git/commitdiff
Rebasing the cluster log daemon code from the most current
authorJonathan Earl Brassow <jbrassow@redhat.com>
Tue, 21 Jul 2009 15:32:13 +0000 (15:32 +0000)
committerJonathan Earl Brassow <jbrassow@redhat.com>
Tue, 21 Jul 2009 15:32:13 +0000 (15:32 +0000)
sources in the 'cluster' tree.  There have been a number of
bug fixes and I don't want to loose them.

daemons/clogd/Makefile
daemons/clogd/cluster.c
daemons/clogd/functions.c
daemons/clogd/local.c

index 73c6db7445621d88990744f47c91c7935d9c4cfd..a28ed0f6c8845b790827b325691c8ad8e6f56af7 100644 (file)
@@ -12,7 +12,7 @@
 
 SOURCES = clogd.c cluster.c functions.c link_mon.c local.c logging.c
 
-TARGET = $(shell if [ ! -e /usr/include/linux/dm-clog-tfr.h ]; then \
+TARGET = $(shell if [ ! -e /usr/include/linux/dm-log-userspace.h ]; then \
                echo 'no_clogd_kernel_headers'; \
        elif [ ! -e /usr/include/linux/ext2_fs.h ]; then \
                echo 'no_e2fsprogs_devel'; \
index 94e1c9ebeb68332819630652e118410957c75a0a..ae2dbe79a165fa16c82f29cb1cf98898596e5338 100644 (file)
@@ -69,12 +69,12 @@ static SaCkptCallbacksT callbacks = { 0, 0 };
 static SaVersionT version = { 'B', 1, 1 };
 
 #define DEBUGGING_HISTORY 100
-static char debugging[DEBUGGING_HISTORY][128];
-static int idx = 0;
-#define LOG_SPRINT(f, arg...) do {\
-               idx++; \
-               idx = idx % DEBUGGING_HISTORY; \
-               sprintf(debugging[idx], f, ## arg); \
+//static char debugging[DEBUGGING_HISTORY][128];
+//static int idx = 0;
+#define LOG_SPRINT(cc, f, arg...) do {         \
+               cc->idx++; \
+               cc->idx = cc->idx % DEBUGGING_HISTORY; \
+               sprintf(cc->debugging[cc->idx], f, ## arg); \
        } while (0)
 
 static int log_resp_rec = 0;
@@ -114,6 +114,8 @@ struct clog_cpg {
        int checkpoints_needed;
        uint32_t checkpoint_requesters[MAX_CHECKPOINT_REQUESTERS];
        struct checkpoint_data *checkpoint_list;
+       int idx;
+       char debugging[DEBUGGING_HISTORY][128];
 };
 
 /* FIXME: Need lock for this */
@@ -731,7 +733,7 @@ static void do_checkpoints(struct clog_cpg *entry, int leaving)
                 */
                switch (export_checkpoint(cp)) {
                case -EEXIST:
-                       LOG_SPRINT("[%s] Checkpoint for %u already handled%s",
+                       LOG_SPRINT(entry, "[%s] Checkpoint for %u already handled%s",
                                   SHORT_UUID(entry->name.value), cp->requester,
                                   (leaving) ? "(L)": "");
                        LOG_COND(log_checkpoint,
@@ -743,7 +745,7 @@ static void do_checkpoints(struct clog_cpg *entry, int leaving)
                        cp = entry->checkpoint_list;
                        break;
                case 0:
-                       LOG_SPRINT("[%s] Checkpoint data available for node %u%s",
+                       LOG_SPRINT(entry, "[%s] Checkpoint data available for node %u%s",
                                   SHORT_UUID(entry->name.value), cp->requester,
                                   (leaving) ? "(L)": "");
                        LOG_COND(log_checkpoint,
@@ -801,7 +803,7 @@ static int resend_requests(struct clog_cpg *entry)
                                 "[%s] Skipping resend of %s/#%u...",
                                 SHORT_UUID(entry->name.value),
                                 _RQ_TYPE(tfr->request_type), tfr->seq);
-                       LOG_SPRINT("###  No resend: [%s] %s/%u ###",
+                       LOG_SPRINT(entry, "###  No resend: [%s] %s/%u ###",
                                   SHORT_UUID(entry->name.value),
                                   _RQ_TYPE(tfr->request_type), tfr->seq);
 
@@ -820,7 +822,7 @@ static int resend_requests(struct clog_cpg *entry)
                                 SHORT_UUID(entry->name.value),
                                 _RQ_TYPE(tfr->request_type),
                                 tfr->seq, entry->lowest_id);
-                       LOG_SPRINT("***  Resending: [%s] %s/%u ***",
+                       LOG_SPRINT(entry, "***  Resending: [%s] %s/%u ***",
                                   SHORT_UUID(entry->name.value),
                                   _RQ_TYPE(tfr->request_type), tfr->seq);
                        r = cluster_send(tfr);
@@ -880,7 +882,7 @@ static int flush_startup_list(struct clog_cpg *entry)
                                free(tfr);
                                continue;
                        }
-                       LOG_SPRINT("[%s] Checkpoint prepared for %u",
+                       LOG_SPRINT(entry, "[%s] Checkpoint prepared for %u",
                                 SHORT_UUID(entry->name.value), tfr->originator);
                        LOG_COND(log_checkpoint, "[%s] Checkpoint prepared for %u",
                                 SHORT_UUID(entry->name.value), tfr->originator);
@@ -997,10 +999,11 @@ static void cpg_message_callback(cpg_handle_t handle, struct cpg_name *gname,
        if (tfr->request_type == DM_CLOG_CHECKPOINT_READY) {
                if (my_cluster_id == tfr->originator) {
                        /* Redundant checkpoints ignored if match->valid */
-                       LOG_SPRINT("[%s] CHECKPOINT_READY notification from %u",
+                       LOG_SPRINT(match, "[%s] CHECKPOINT_READY notification from %u",
                                   SHORT_UUID(tfr->uuid), nodeid);
                        if (import_checkpoint(match, (match->state != INVALID))) {
-                               LOG_SPRINT("[%s] Failed to import checkpoint from %u",
+                               LOG_SPRINT(match,
+                                          "[%s] Failed to import checkpoint from %u",
                                           SHORT_UUID(tfr->uuid), nodeid);
                                LOG_ERROR("[%s] Failed to import checkpoint from %u",
                                          SHORT_UUID(tfr->uuid), nodeid);
@@ -1008,7 +1011,8 @@ static void cpg_message_callback(cpg_handle_t handle, struct cpg_name *gname,
                                /* Could we retry? */
                                goto out;
                        } else if (match->state == INVALID) {
-                               LOG_SPRINT("[%s] Checkpoint data received from %u.  Log is now valid",
+                               LOG_SPRINT(match,
+                                          "[%s] Checkpoint data received from %u.  Log is now valid",
                                           SHORT_UUID(match->name.value), nodeid);
                                LOG_COND(log_checkpoint,
                                         "[%s] Checkpoint data received from %u.  Log is now valid",
@@ -1017,7 +1021,8 @@ static void cpg_message_callback(cpg_handle_t handle, struct cpg_name *gname,
 
                                flush_startup_list(match);
                        } else {
-                               LOG_SPRINT("[%s] Redundant checkpoint from %u ignored.",
+                               LOG_SPRINT(match,
+                                          "[%s] Redundant checkpoint from %u ignored.",
                                           SHORT_UUID(tfr->uuid), nodeid);
                        }
                }
@@ -1078,7 +1083,7 @@ static void cpg_message_callback(cpg_handle_t handle, struct cpg_name *gname,
                                  SHORT_UUID(tfr->uuid), match->checkpoint_requesters[i]);
                        break;
                }
-               LOG_SPRINT("[%s] Checkpoint prepared for %u* (%s)",
+               LOG_SPRINT(match, "[%s] Checkpoint prepared for %u* (%s)",
                           SHORT_UUID(tfr->uuid), match->checkpoint_requesters[i],
                           (log_get_state(tfr) != LOG_RESUMED)? "LOG_RESUMED": "LOG_SUSPENDED");
                LOG_COND(log_checkpoint, "[%s] Checkpoint prepared for %u*",
@@ -1106,21 +1111,22 @@ out:
 
                LOG_ERROR("HISTORY::");
                for (i = 0; i < DEBUGGING_HISTORY; i++) {
-                       idx++;
-                       idx = idx % DEBUGGING_HISTORY;
-                       if (debugging[idx][0] == '\0')
+                       match->idx++;
+                       match->idx = match->idx % DEBUGGING_HISTORY;
+                       if (match->debugging[match->idx][0] == '\0')
                                continue;
-                       LOG_ERROR("%d:%d) %s", i, idx, debugging[idx]);
+                       LOG_ERROR("%d:%d) %s", i, match->idx,
+                                match->debugging[match->idx]);
                }
        } else if (!(tfr->request_type & DM_CLOG_RESPONSE) ||
                   (tfr->originator == my_cluster_id)) {
                if (!response)
-                       LOG_SPRINT("SEQ#=%u, UUID=%s, TYPE=%s, ORIG=%u, RESP=%s",
+                       LOG_SPRINT(match, "SEQ#=%u, UUID=%s, TYPE=%s, ORIG=%u, RESP=%s",
                                   tfr->seq, SHORT_UUID(tfr->uuid),
                                   _RQ_TYPE(tfr->request_type),
                                   tfr->originator, (response) ? "YES" : "NO");
                else
-                       LOG_SPRINT("SEQ#=%u, UUID=%s, TYPE=%s, ORIG=%u, RESP=%s, RSPR=%u",
+                       LOG_SPRINT(match, "SEQ#=%u, UUID=%s, TYPE=%s, ORIG=%u, RESP=%s, RSPR=%u",
                                   tfr->seq, SHORT_UUID(tfr->uuid),
                                   _RQ_TYPE(tfr->request_type),
                                   tfr->originator, (response) ? "YES" : "NO",
@@ -1203,7 +1209,7 @@ out:
                LOG_COND(log_membership_change, "[%s]  Server unchanged at %u (%u joined)",
                         SHORT_UUID(match->name.value),
                         lowest, joined->nodeid);
-       LOG_SPRINT("+++  UUID=%s  %u join  +++",
+       LOG_SPRINT(match, "+++  UUID=%s  %u join  +++",
                   SHORT_UUID(match->name.value), joined->nodeid);
 }
 
@@ -1218,7 +1224,7 @@ static void cpg_leave_callback(struct clog_cpg *match,
        struct clog_tfr *tfr;
        struct checkpoint_data *p_cp, *c_cp;
 
-       LOG_SPRINT("---  UUID=%s  %u left  ---",
+       LOG_SPRINT(match, "---  UUID=%s  %u left  ---",
                   SHORT_UUID(match->name.value), left->nodeid);
 
        /* Am I leaving? */
@@ -1574,8 +1580,8 @@ int init_cluster(void)
        int i;
        SaAisErrorT rv;
 
-       for (i = 0; i < DEBUGGING_HISTORY; i++)
-               debugging[i][0] = '\0';
+//     for (i = 0; i < DEBUGGING_HISTORY; i++)
+//             debugging[i][0] = '\0';
 
        INIT_LIST_HEAD(&clog_cpg_list);
        rv = saCkptInitialize(&ckpt_handle, &callbacks, &version);
@@ -1634,14 +1640,15 @@ void cluster_debug(void)
                        t = (struct clog_tfr *)p;
                        LOG_ERROR("  %s/%u", _RQ_TYPE(t->request_type), t->seq);
                }
-       }
 
-       LOG_ERROR("Command History:");
-       for (i = 0; i < DEBUGGING_HISTORY; i++) {
-               idx++;
-               idx = idx % DEBUGGING_HISTORY;
-               if (debugging[idx][0] == '\0')
-                       continue;
-               LOG_ERROR("%d:%d) %s", i, idx, debugging[idx]);
+               LOG_ERROR("Command History:");
+               for (i = 0; i < DEBUGGING_HISTORY; i++) {
+                       entry->idx++;
+                       entry->idx = entry->idx % DEBUGGING_HISTORY;
+                       if (entry->debugging[entry->idx][0] == '\0')
+                               continue;
+                       LOG_ERROR("%d:%d) %s", i, entry->idx,
+                                 entry->debugging[entry->idx]);
+               }
        }
 }
index 45fdc1ae24a20d3faeb5cbd77768c15c9dcd052d..8bf48c1a1a6a278f33afea51d738b257469e3247 100644 (file)
 #define LOG_OFFSET 2
 
 #define RESYNC_HISTORY 50
-static char resync_history[RESYNC_HISTORY][128];
-static int idx = 0;
-#define LOG_SPRINT(f, arg...) do {\
-               idx++; \
-               idx = idx % RESYNC_HISTORY; \
-               sprintf(resync_history[idx], f, ## arg); \
+//static char resync_history[RESYNC_HISTORY][128];
+//static int idx = 0;
+#define LOG_SPRINT(_lc, f, arg...) do {                \
+               lc->idx++; \
+               lc->idx = lc->idx % RESYNC_HISTORY; \
+               sprintf(lc->resync_history[lc->idx], f, ## arg); \
        } while (0)
 
 struct log_header {
@@ -86,6 +86,8 @@ struct log_c {
        uint64_t disk_nr_regions;
        size_t disk_size;       /* size of disk_buffer in bytes */
        void *disk_buffer;      /* aligned memory for O_DIRECT */
+       int idx;
+       char resync_history[RESYNC_HISTORY][128];
 };
 
 struct mark_entry {
@@ -545,8 +547,9 @@ static int clog_ctr(struct clog_tfr *tfr)
 
        if (strlen(tfr->data) != tfr->data_size) {
                LOG_ERROR("Received constructor request with bad data");
-               LOG_ERROR("strlen(tfr->data)[%d] != tfr->data_size[%d]",
-                         (int)strlen(tfr->data), tfr->data_size);
+               LOG_ERROR("strlen(tfr->data)[%d] != tfr->data_size[%llu]",
+                         (int)strlen(tfr->data),
+                         (unsigned long long)tfr->data_size);
                LOG_ERROR("tfr->data = '%s' [%d]",
                          tfr->data, (int)strlen(tfr->data));
                return -EINVAL;
@@ -814,7 +817,7 @@ out:
 
        lc->sync_count = count_bits32(lc->sync_bits, lc->bitset_uint32_count);
 
-       LOG_SPRINT("[%s] Initial sync_count = %llu",
+       LOG_SPRINT(lc, "[%s] Initial sync_count = %llu",
                   SHORT_UUID(lc->uuid), (unsigned long long)lc->sync_count);
        lc->sync_search = 0;
        lc->state = LOG_RESUMED;
@@ -1164,7 +1167,11 @@ static int clog_clear_region(struct clog_tfr *tfr)
  */
 static int clog_get_resync_work(struct clog_tfr *tfr)
 {
-       struct {int i; uint64_t r; } *pkg = (void *)tfr->data;
+       struct {
+               int32_t i;
+               uint32_t arch_padding;
+               uint64_t r;
+       } *pkg = (void *)tfr->data;
        struct log_c *lc = get_log(tfr->uuid);
 
        if (!lc)
@@ -1178,7 +1185,7 @@ static int clog_get_resync_work(struct clog_tfr *tfr)
                 * FIXME: handle intermittent errors during recovery
                 * by resetting sync_search... but not to many times.
                 */
-               LOG_SPRINT("GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
+               LOG_SPRINT(lc, "GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
                           "Recovery finished",
                           tfr->seq, SHORT_UUID(lc->uuid), tfr->originator);
                return 0;
@@ -1186,7 +1193,7 @@ static int clog_get_resync_work(struct clog_tfr *tfr)
 
        if (lc->recovering_region != (uint64_t)-1) {
                if (lc->recoverer == tfr->originator) {
-                       LOG_SPRINT("GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
+                       LOG_SPRINT(lc, "GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
                                   "Re-requesting work (%llu)",
                                   tfr->seq, SHORT_UUID(lc->uuid), tfr->originator,
                                   (unsigned long long)lc->recovering_region);
@@ -1194,7 +1201,7 @@ static int clog_get_resync_work(struct clog_tfr *tfr)
                        pkg->i = 1;
                        LOG_COND(log_resend_requests, "***** RE-REQUEST *****");
                } else {
-                       LOG_SPRINT("GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
+                       LOG_SPRINT(lc, "GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
                                   "Someone already recovering (%llu)",
                                   tfr->seq, SHORT_UUID(lc->uuid), tfr->originator,
                                   (unsigned long long)lc->recovering_region);
@@ -1213,7 +1220,7 @@ static int clog_get_resync_work(struct clog_tfr *tfr)
                free(del);
 
                if (!log_test_bit(lc->sync_bits, pkg->r)) {
-                       LOG_SPRINT("GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
+                       LOG_SPRINT(lc, "GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
                                   "Assigning priority resync work (%llu)",
                                   tfr->seq, SHORT_UUID(lc->uuid), tfr->originator,
                                   (unsigned long long)pkg->r);
@@ -1229,7 +1236,7 @@ static int clog_get_resync_work(struct clog_tfr *tfr)
                                    lc->sync_search);
 
        if (pkg->r >= lc->region_count) {
-               LOG_SPRINT("GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
+               LOG_SPRINT(lc, "GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
                           "Resync work complete.",
                           tfr->seq, SHORT_UUID(lc->uuid), tfr->originator);
                return 0;
@@ -1237,7 +1244,7 @@ static int clog_get_resync_work(struct clog_tfr *tfr)
 
        lc->sync_search = pkg->r + 1;
 
-       LOG_SPRINT("GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
+       LOG_SPRINT(lc, "GET - SEQ#=%u, UUID=%s, nodeid = %u:: "
                   "Assigning resync work (%llu)",
                   tfr->seq, SHORT_UUID(lc->uuid), tfr->originator,
                   (unsigned long long)pkg->r);
@@ -1254,7 +1261,11 @@ static int clog_get_resync_work(struct clog_tfr *tfr)
  */
 static int clog_set_region_sync(struct clog_tfr *tfr)
 {
-       struct { uint64_t region; int in_sync; } *pkg = (void *)tfr->data;
+       struct {
+               uint64_t region;
+               uint32_t arch_padding;
+               int32_t in_sync;
+       } *pkg = (void *)tfr->data;
        struct log_c *lc = get_log(tfr->uuid);
 
        if (!lc)
@@ -1264,7 +1275,7 @@ static int clog_set_region_sync(struct clog_tfr *tfr)
 
        if (pkg->in_sync) {
                if (log_test_bit(lc->sync_bits, pkg->region)) {
-                       LOG_SPRINT("SET - SEQ#=%u, UUID=%s, nodeid = %u:: "
+                       LOG_SPRINT(lc, "SET - SEQ#=%u, UUID=%s, nodeid = %u:: "
                                   "Region already set (%llu)",
                                   tfr->seq, SHORT_UUID(lc->uuid), tfr->originator,
                                   (unsigned long long)pkg->region);
@@ -1273,7 +1284,7 @@ static int clog_set_region_sync(struct clog_tfr *tfr)
                        lc->sync_count++;
 
                        /* The rest of this section is all for debugging */
-                       LOG_SPRINT("SET - SEQ#=%u, UUID=%s, nodeid = %u:: "
+                       LOG_SPRINT(lc, "SET - SEQ#=%u, UUID=%s, nodeid = %u:: "
                                   "Setting region (%llu)",
                                   tfr->seq, SHORT_UUID(lc->uuid), tfr->originator,
                                   (unsigned long long)pkg->region);
@@ -1291,7 +1302,7 @@ static int clog_set_region_sync(struct clog_tfr *tfr)
 
                        if (!log_test_bit(lc->sync_bits,
                                          (pkg->region) ? pkg->region - 1 : 0)) {
-                               LOG_SPRINT("*** Previous bit not set ***");
+                               LOG_SPRINT(lc, "*** Previous bit not set ***");
                                lc->skip_bit_warning = (pkg->region) ?
                                        pkg->region - 1 : 0;
                        }
@@ -1299,7 +1310,7 @@ static int clog_set_region_sync(struct clog_tfr *tfr)
        } else if (log_test_bit(lc->sync_bits, pkg->region)) {
                lc->sync_count--;
                log_clear_bit(lc, lc->sync_bits, pkg->region);
-               LOG_SPRINT("SET - SEQ#=%u, UUID=%s, nodeid = %u:: "
+               LOG_SPRINT(lc, "SET - SEQ#=%u, UUID=%s, nodeid = %u:: "
                           "Unsetting region (%llu)",
                           tfr->seq, SHORT_UUID(lc->uuid), tfr->originator,
                           (unsigned long long)pkg->region);
@@ -1308,7 +1319,7 @@ static int clog_set_region_sync(struct clog_tfr *tfr)
        if (lc->sync_count != count_bits32(lc->sync_bits, lc->bitset_uint32_count)) {
                unsigned long long reset = count_bits32(lc->sync_bits, lc->bitset_uint32_count);
 
-               LOG_SPRINT("SET - SEQ#=%u, UUID=%s, nodeid = %u:: "
+               LOG_SPRINT(lc, "SET - SEQ#=%u, UUID=%s, nodeid = %u:: "
                           "sync_count(%llu) != bitmap count(%llu)",
                           tfr->seq, SHORT_UUID(lc->uuid), tfr->originator,
                           (unsigned long long)lc->sync_count, reset);
@@ -1319,7 +1330,7 @@ static int clog_set_region_sync(struct clog_tfr *tfr)
        }
 
        if (lc->sync_count > lc->region_count)
-               LOG_SPRINT("SET - SEQ#=%u, UUID=%s, nodeid = %u:: "
+               LOG_SPRINT(lc, "SET - SEQ#=%u, UUID=%s, nodeid = %u:: "
                           "(lc->sync_count > lc->region_count) - this is bad",
                           tfr->seq, SHORT_UUID(lc->uuid), tfr->originator);
 
@@ -1355,7 +1366,7 @@ static int clog_get_sync_count(struct clog_tfr *tfr)
        if (lc->sync_count != count_bits32(lc->sync_bits, lc->bitset_uint32_count)) {
                unsigned long long reset = count_bits32(lc->sync_bits, lc->bitset_uint32_count);
 
-               LOG_SPRINT("get_sync_count - SEQ#=%u, UUID=%s, nodeid = %u:: "
+               LOG_SPRINT(lc, "get_sync_count - SEQ#=%u, UUID=%s, nodeid = %u:: "
                           "sync_count(%llu) != bitmap count(%llu)",
                           tfr->seq, SHORT_UUID(lc->uuid), tfr->originator,
                           (unsigned long long)lc->sync_count, reset);
@@ -1485,7 +1496,11 @@ static int clog_status_table(struct clog_tfr *tfr)
 static int clog_is_remote_recovering(struct clog_tfr *tfr)
 {
        uint64_t region = *((uint64_t *)(tfr->data));
-       struct { int is_recovering; uint64_t in_sync_hint; } *pkg = (void *)tfr->data;
+       struct {
+               int32_t is_recovering;
+               uint32_t arch_padding;
+               uint64_t in_sync_hint;
+       } *pkg = (void *)tfr->data;
        struct log_c *lc = get_log(tfr->uuid);
 
        if (!lc)
@@ -1505,9 +1520,9 @@ static int clog_is_remote_recovering(struct clog_tfr *tfr)
                /*
                 * Remember, 'lc->sync_search' is 1 plus the region
                 * currently being recovered.  So, we must take off 1
-                * to account for that.
+                * to account for that; but only if 'sync_search > 1'.
                 */
-               pkg->in_sync_hint = (lc->sync_search - 1);
+               pkg->in_sync_hint = lc->sync_search ? (lc->sync_search - 1) : 0;
                LOG_DBG("[%s] Region is %s: %llu",
                        SHORT_UUID(lc->uuid),
                        (region == lc->recovering_region) ?
@@ -1688,7 +1703,7 @@ int push_state(const char *uuid, const char *which, char **buf, uint32_t debug_w
                sprintf(*buf, "%llu %u", (unsigned long long)lc->recovering_region,
                        lc->recoverer);
 
-               LOG_SPRINT("CKPT SEND - SEQ#=X, UUID=%s, nodeid = %u:: "
+               LOG_SPRINT(lc, "CKPT SEND - SEQ#=X, UUID=%s, nodeid = %u:: "
                           "recovering_region=%llu, recoverer=%u, sync_count=%llu",
                           SHORT_UUID(lc->uuid), debug_who,
                           (unsigned long long)lc->recovering_region,
@@ -1738,7 +1753,7 @@ int pull_state(const char *uuid, const char *which, char *buf, int size)
        if (!strncmp(which, "recovering_region", 17)) {
                sscanf(buf, "%llu %u", (unsigned long long *)&lc->recovering_region,
                       &lc->recoverer);
-               LOG_SPRINT("CKPT INIT - SEQ#=X, UUID=%s, nodeid = X:: "
+               LOG_SPRINT(lc, "CKPT INIT - SEQ#=X, UUID=%s, nodeid = X:: "
                           "recovering_region=%llu, recoverer=%u",
                           SHORT_UUID(lc->uuid),
                           (unsigned long long)lc->recovering_region, lc->recoverer);
@@ -1808,14 +1823,10 @@ void log_debug(void)
        LOG_ERROR("");
        LOG_ERROR("LOG COMPONENT DEBUGGING::");
        LOG_ERROR("Official log list:");
-       __list_for_each(l, &log_list) {
+       LOG_ERROR("Pending log list:");
+       __list_for_each(l, &log_pending_list) {
                lc = list_entry(l, struct log_c, list);
                LOG_ERROR("%s", lc->uuid);
-               LOG_ERROR("  recoverer        : %u", lc->recoverer);
-               LOG_ERROR("  recovering_region: %llu",
-                         (unsigned long long)lc->recovering_region);
-               LOG_ERROR("  recovery_halted  : %s", (lc->recovery_halted) ?
-                         "YES" : "NO");
                LOG_ERROR("sync_bits:");
                print_bits((char *)lc->sync_bits,
                           lc->bitset_uint32_count * sizeof(*lc->sync_bits), 1);
@@ -1824,19 +1835,21 @@ void log_debug(void)
                           lc->bitset_uint32_count * sizeof(*lc->clean_bits), 1);
        }
 
-       LOG_ERROR("Pending log list:");
-       __list_for_each(l, &log_pending_list) {
+       __list_for_each(l, &log_list) {
                lc = list_entry(l, struct log_c, list);
                LOG_ERROR("%s", lc->uuid);
+               LOG_ERROR("  recoverer        : %u", lc->recoverer);
+               LOG_ERROR("  recovering_region: %llu",
+                         (unsigned long long)lc->recovering_region);
+               LOG_ERROR("  recovery_halted  : %s", (lc->recovery_halted) ?
+                         "YES" : "NO");
                LOG_ERROR("sync_bits:");
                print_bits((char *)lc->sync_bits,
                           lc->bitset_uint32_count * sizeof(*lc->sync_bits), 1);
                LOG_ERROR("clean_bits:");
                print_bits((char *)lc->clean_bits,
                           lc->bitset_uint32_count * sizeof(*lc->clean_bits), 1);
-       }
 
-       __list_for_each(l, &log_list) {
                lc = list_entry(l, struct log_c, list);
                LOG_ERROR("Validating %s::", SHORT_UUID(lc->uuid));
                r = find_next_zero_bit(lc->sync_bits, lc->region_count, 0);
@@ -1851,14 +1864,15 @@ void log_debug(void)
                        LOG_ERROR("ADJUSTING SYNC_COUNT");
                        lc->sync_count = lc->region_count;
                }
-       }
 
-       LOG_ERROR("Resync request history:");
-       for (i = 0; i < RESYNC_HISTORY; i++) {
-               idx++;
-               idx = idx % RESYNC_HISTORY;
-               if (resync_history[idx][0] == '\0')
-                       continue;
-               LOG_ERROR("%d:%d) %s", i, idx, resync_history[idx]);
+               LOG_ERROR("Resync request history:");
+               for (i = 0; i < RESYNC_HISTORY; i++) {
+                       lc->idx++;
+                       lc->idx = lc->idx % RESYNC_HISTORY;
+                       if (lc->resync_history[lc->idx][0] == '\0')
+                               continue;
+                       LOG_ERROR("%d:%d) %s", i, lc->idx,
+                                 lc->resync_history[lc->idx]);
+               }
        }
 }
index 7f9a403fa20e2d02106993d4909a89f466f3c728..cf64855d84f595fab46a09de88b77eebd186b2ff 100644 (file)
@@ -263,6 +263,7 @@ static int do_local_work(void *data)
        case DM_CLOG_GET_REGION_SIZE:
        default:
                LOG_ERROR("Invalid log request received, ignoring.");
+
                return 0;
        }
 
This page took 0.062955 seconds and 5 git commands to generate.