aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/osdmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ceph/osdmap.c')
-rw-r--r--fs/ceph/osdmap.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c
index b83f2692b835..21c6623c4b07 100644
--- a/fs/ceph/osdmap.c
+++ b/fs/ceph/osdmap.c
@@ -1,4 +1,7 @@
1 1
2#include "ceph_debug.h"
3
4#include <linux/slab.h>
2#include <asm/div64.h> 5#include <asm/div64.h>
3 6
4#include "super.h" 7#include "super.h"
@@ -6,7 +9,6 @@
6#include "crush/hash.h" 9#include "crush/hash.h"
7#include "crush/mapper.h" 10#include "crush/mapper.h"
8#include "decode.h" 11#include "decode.h"
9#include "ceph_debug.h"
10 12
11char *ceph_osdmap_state_str(char *str, int len, int state) 13char *ceph_osdmap_state_str(char *str, int len, int state)
12{ 14{
@@ -480,6 +482,14 @@ static struct ceph_pg_pool_info *__lookup_pg_pool(struct rb_root *root, int id)
480 return NULL; 482 return NULL;
481} 483}
482 484
485void __decode_pool(void **p, struct ceph_pg_pool_info *pi)
486{
487 ceph_decode_copy(p, &pi->v, sizeof(pi->v));
488 calc_pg_masks(pi);
489 *p += le32_to_cpu(pi->v.num_snaps) * sizeof(u64);
490 *p += le32_to_cpu(pi->v.num_removed_snap_intervals) * sizeof(u64) * 2;
491}
492
483/* 493/*
484 * decode a full map. 494 * decode a full map.
485 */ 495 */
@@ -526,12 +536,8 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
526 ev, CEPH_PG_POOL_VERSION); 536 ev, CEPH_PG_POOL_VERSION);
527 goto bad; 537 goto bad;
528 } 538 }
529 ceph_decode_copy(p, &pi->v, sizeof(pi->v)); 539 __decode_pool(p, pi);
530 __insert_pg_pool(&map->pg_pools, pi); 540 __insert_pg_pool(&map->pg_pools, pi);
531 calc_pg_masks(pi);
532 *p += le32_to_cpu(pi->v.num_snaps) * sizeof(u64);
533 *p += le32_to_cpu(pi->v.num_removed_snap_intervals)
534 * sizeof(u64) * 2;
535 } 541 }
536 ceph_decode_32_safe(p, end, map->pool_max, bad); 542 ceph_decode_32_safe(p, end, map->pool_max, bad);
537 543
@@ -714,8 +720,7 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
714 pi->id = pool; 720 pi->id = pool;
715 __insert_pg_pool(&map->pg_pools, pi); 721 __insert_pg_pool(&map->pg_pools, pi);
716 } 722 }
717 ceph_decode_copy(p, &pi->v, sizeof(pi->v)); 723 __decode_pool(p, pi);
718 calc_pg_masks(pi);
719 } 724 }
720 725
721 /* old_pool */ 726 /* old_pool */