Message ID | 1395944299-21970-25-git-send-email-ilya.dryomov@inktank.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 03/27/2014 01:18 PM, Ilya Dryomov wrote: > Sync up with ceph.git definitions. Bring in ceph_osd_is_down(). Looks good. (Though I didn't verify it matches Ceph's definitions...) Reviewed-by: Alex Elder <elder@linaro.org> > Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> > --- > include/linux/ceph/osdmap.h | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > 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, > 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) > -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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, 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)
Sync up with ceph.git definitions. Bring in ceph_osd_is_down(). Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> --- include/linux/ceph/osdmap.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)