diff options
| author | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-03-24 11:12:46 -0400 |
|---|---|---|
| committer | Sage Weil <sage@inktank.com> | 2014-04-05 00:08:07 -0400 |
| commit | 246138fa6787db6f4016f26604fdc05dc9f95627 (patch) | |
| tree | e0d4a76125ec16c1137ca555f2115a91155f89a1 /include/linux | |
| parent | ddf3a21a03d0f01c5ba83deaecd2d0c381d5ef42 (diff) | |
libceph: ceph_osd_{exists,is_up,is_down}(osd) definitions
Sync up with ceph.git definitions. Bring in ceph_osd_is_down().
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ceph/osdmap.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h index 6e030cb3c9ca..0895797b9e28 100644 --- a/include/linux/ceph/osdmap.h +++ b/include/linux/ceph/osdmap.h | |||
| @@ -125,9 +125,21 @@ static inline void ceph_oid_copy(struct ceph_object_id *dest, | |||
| 125 | dest->name_len = src->name_len; | 125 | dest->name_len = src->name_len; |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | static inline int ceph_osd_exists(struct ceph_osdmap *map, int osd) | ||
| 129 | { | ||
| 130 | return osd >= 0 && osd < map->max_osd && | ||
| 131 | (map->osd_state[osd] & CEPH_OSD_EXISTS); | ||
| 132 | } | ||
| 133 | |||
| 128 | static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd) | 134 | static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd) |
| 129 | { | 135 | { |
| 130 | return (osd < map->max_osd) && (map->osd_state[osd] & CEPH_OSD_UP); | 136 | return ceph_osd_exists(map, osd) && |
| 137 | (map->osd_state[osd] & CEPH_OSD_UP); | ||
| 138 | } | ||
| 139 | |||
| 140 | static inline int ceph_osd_is_down(struct ceph_osdmap *map, int osd) | ||
| 141 | { | ||
| 142 | return !ceph_osd_is_up(map, osd); | ||
| 131 | } | 143 | } |
| 132 | 144 | ||
| 133 | static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag) | 145 | static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag) |
