diff options
-rw-r--r-- | net/ceph/osdmap.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 369f03ba9ee5..3c61e21611d3 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
@@ -13,26 +13,18 @@ | |||
13 | 13 | ||
14 | char *ceph_osdmap_state_str(char *str, int len, int state) | 14 | char *ceph_osdmap_state_str(char *str, int len, int state) |
15 | { | 15 | { |
16 | int flag = 0; | ||
17 | |||
18 | if (!len) | 16 | if (!len) |
19 | goto done; | 17 | return str; |
20 | 18 | ||
21 | *str = '\0'; | 19 | if ((state & CEPH_OSD_EXISTS) && (state & CEPH_OSD_UP)) |
22 | if (state) { | 20 | snprintf(str, len, "exists, up"); |
23 | if (state & CEPH_OSD_EXISTS) { | 21 | else if (state & CEPH_OSD_EXISTS) |
24 | snprintf(str, len, "exists"); | 22 | snprintf(str, len, "exists"); |
25 | flag = 1; | 23 | else if (state & CEPH_OSD_UP) |
26 | } | 24 | snprintf(str, len, "up"); |
27 | if (state & CEPH_OSD_UP) { | 25 | else |
28 | snprintf(str, len, "%s%s%s", str, (flag ? ", " : ""), | ||
29 | "up"); | ||
30 | flag = 1; | ||
31 | } | ||
32 | } else { | ||
33 | snprintf(str, len, "doesn't exist"); | 26 | snprintf(str, len, "doesn't exist"); |
34 | } | 27 | |
35 | done: | ||
36 | return str; | 28 | return str; |
37 | } | 29 | } |
38 | 30 | ||