Skip to content

Commit

Permalink
libceph: handle new osdmap down/state change encoding
Browse files Browse the repository at this point in the history
Old incrementals encode a 0 value (nearly always) when an osd goes down.
Change that to allow any state bit(s) to be flipped.  Special case 0 to
mean flip the CEPH_OSD_UP bit to mimic the old behavior.

Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Sage Weil committed May 24, 2011
1 parent 9db4b3e commit 7662d8f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions net/ceph/osdmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,15 +830,20 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
map->osd_addr[osd] = addr;
}

/* new_down */
/* new_state */
ceph_decode_32_safe(p, end, len, bad);
while (len--) {
u32 osd;
u8 xorstate;
ceph_decode_32_safe(p, end, osd, bad);
xorstate = **(u8 **)p;
(*p)++; /* clean flag */
pr_info("osd%d down\n", osd);
if (xorstate == 0)
xorstate = CEPH_OSD_UP;
if (xorstate & CEPH_OSD_UP)
pr_info("osd%d down\n", osd);
if (osd < map->max_osd)
map->osd_state[osd] &= ~CEPH_OSD_UP;
map->osd_state[osd] ^= xorstate;
}

/* new_weight */
Expand Down

0 comments on commit 7662d8f

Please sign in to comment.