aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ceph/osdmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ceph/osdmap.h')
-rw-r--r--include/linux/ceph/osdmap.h14
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
128static 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
128static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd) 134static 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
140static 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
133static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag) 145static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag)