diff options
author | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-03-24 17:12:46 +0200 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2014-04-04 21:08:07 -0700 |
commit | 246138fa6787db6f4016f26604fdc05dc9f95627 (patch) | |
tree | e0d4a76125ec16c1137ca555f2115a91155f89a1 /include/linux/ceph | |
parent | ddf3a21a03d0f01c5ba83deaecd2d0c381d5ef42 (diff) | |
download | op-kernel-dev-246138fa6787db6f4016f26604fdc05dc9f95627.zip op-kernel-dev-246138fa6787db6f4016f26604fdc05dc9f95627.tar.gz |
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/ceph')
-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 6e030cb..0895797 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, dest->name_len = src->name_len; } +static inline int ceph_osd_exists(struct ceph_osdmap *map, int osd) +{ + return osd >= 0 && osd < map->max_osd && + (map->osd_state[osd] & CEPH_OSD_EXISTS); +} + static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd) { - return (osd < map->max_osd) && (map->osd_state[osd] & CEPH_OSD_UP); + return ceph_osd_exists(map, osd) && + (map->osd_state[osd] & CEPH_OSD_UP); +} + +static inline int ceph_osd_is_down(struct ceph_osdmap *map, int osd) +{ + return !ceph_osd_is_up(map, osd); } static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag) |