aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-04-01 19:58:26 -0400
committerSage Weil <sage@inktank.com>2013-05-02 00:17:52 -0400
commitef4859d6479d19bcc65c3156cf3b7dd747355c29 (patch)
tree83a977e35c7dd32834d707f93173c1e00da06384 /include/linux/ceph
parent8058fd45039724695d5b67a574544452635d64a9 (diff)
libceph: define ceph_decode_pgid() only once
There are two basically identical definitions of __decode_pgid() in libceph, one in "net/ceph/osdmap.c" and the other in "net/ceph/osd_client.c". Get rid of both, and instead define a single inline version in "include/linux/ceph/osdmap.h". Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'include/linux/ceph')
-rw-r--r--include/linux/ceph/osdmap.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 167daf60c4e8..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,