summaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2017-06-21 17:27:17 +0200
committerIlya Dryomov <idryomov@gmail.com>2017-07-07 17:25:18 +0200
commit278b1d709c6acc6f7d138fed775c76695b068e43 (patch)
treeb09bfb75761ff13c956e310834c34e25e34576ba /net/ceph
parentab75144be08cfc1d80f49e9c37970fcadb1215a2 (diff)
downloadlinux-stable-278b1d709c6acc6f7d138fed775c76695b068e43.tar.gz
linux-stable-278b1d709c6acc6f7d138fed775c76695b068e43.tar.bz2
linux-stable-278b1d709c6acc6f7d138fed775c76695b068e43.zip
libceph: ceph_decode_skip_* helpers
Some of these won't be as efficient as they could be (e.g. ceph_decode_skip_set(... 32 ...) could advance by len * sizeof(u32) once instead of advancing by sizeof(u32) len times), but that's fine and not worth a bunch of extra macro code. Replace skip_name_map() with ceph_decode_skip_map as an example. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/osdmap.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index 423747714017..f6d561edd511 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -138,21 +138,6 @@ bad:
return -EINVAL;
}
-static int skip_name_map(void **p, void *end)
-{
- int len;
- ceph_decode_32_safe(p, end, len ,bad);
- while (len--) {
- int strlen;
- *p += sizeof(u32);
- ceph_decode_32_safe(p, end, strlen, bad);
- *p += strlen;
-}
- return 0;
-bad:
- return -EINVAL;
-}
-
static void crush_finalize(struct crush_map *c)
{
__s32 b;
@@ -187,7 +172,6 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
void **p = &pbyval;
void *start = pbyval;
u32 magic;
- u32 num_name_maps;
dout("crush_decode %p to %p len %d\n", *p, end, (int)(end - *p));
@@ -353,12 +337,9 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
}
}
- /* ignore trailing name maps. */
- for (num_name_maps = 0; num_name_maps < 3; num_name_maps++) {
- err = skip_name_map(p, end);
- if (err < 0)
- goto done;
- }
+ ceph_decode_skip_map(p, end, 32, string, bad); /* type_map */
+ ceph_decode_skip_map(p, end, 32, string, bad); /* name_map */
+ ceph_decode_skip_map(p, end, 32, string, bad); /* rule_name_map */
/* tunables */
ceph_decode_need(p, end, 3*sizeof(u32), done);