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.h30
1 files changed, 26 insertions, 4 deletions
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index c819190d1642..d05cc4451af6 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/rbtree.h> 4#include <linux/rbtree.h>
5#include <linux/ceph/types.h> 5#include <linux/ceph/types.h>
6#include <linux/ceph/decode.h>
6#include <linux/ceph/ceph_fs.h> 7#include <linux/ceph/ceph_fs.h>
7#include <linux/crush/crush.h> 8#include <linux/crush/crush.h>
8 9
@@ -119,6 +120,29 @@ static inline struct ceph_entity_addr *ceph_osd_addr(struct ceph_osdmap *map,
119 return &map->osd_addr[osd]; 120 return &map->osd_addr[osd];
120} 121}
121 122
123static inline int ceph_decode_pgid(void **p, void *end, struct ceph_pg *pgid)
124{
125 __u8 version;
126
127 if (!ceph_has_room(p, end, 1 + 8 + 4 + 4)) {
128 pr_warning("incomplete pg encoding");
129
130 return -EINVAL;
131 }
132 version = ceph_decode_8(p);
133 if (version > 1) {
134 pr_warning("do not understand pg encoding %d > 1",
135 (int)version);
136 return -EINVAL;
137 }
138
139 pgid->pool = ceph_decode_64(p);
140 pgid->seed = ceph_decode_32(p);
141 *p += 4; /* skip deprecated preferred value */
142
143 return 0;
144}
145
122extern struct ceph_osdmap *osdmap_decode(void **p, void *end); 146extern struct ceph_osdmap *osdmap_decode(void **p, void *end);
123extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, 147extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
124 struct ceph_osdmap *map, 148 struct ceph_osdmap *map,
@@ -131,10 +155,8 @@ extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
131 u64 *bno, u64 *oxoff, u64 *oxlen); 155 u64 *bno, u64 *oxoff, u64 *oxlen);
132 156
133/* calculate mapping of object to a placement group */ 157/* calculate mapping of object to a placement group */
134extern int ceph_calc_object_layout(struct ceph_pg *pg, 158extern int ceph_calc_ceph_pg(struct ceph_pg *pg, const char *oid,
135 const char *oid, 159 struct ceph_osdmap *osdmap, uint64_t pool);
136 struct ceph_file_layout *fl,
137 struct ceph_osdmap *osdmap);
138extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, 160extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap,
139 struct ceph_pg pgid, 161 struct ceph_pg pgid,
140 int *acting); 162 int *acting);