libceph: pi->min_size, pi->last_force_request_resend
authorIlya Dryomov <idryomov@gmail.com>
Thu, 28 Apr 2016 14:07:23 +0000 (16:07 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 25 May 2016 22:36:26 +0000 (00:36 +0200)
Add and decode pi->min_size and pi->last_force_request_resend.  These
are going to be used by calc_target().

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
include/linux/ceph/osdmap.h
net/ceph/debugfs.c
net/ceph/osdmap.c

index 7783237..989294d 100644 (file)
@@ -26,20 +26,23 @@ struct ceph_pg {
 
 int ceph_pg_compare(const struct ceph_pg *lhs, const struct ceph_pg *rhs);
 
-#define CEPH_POOL_FLAG_HASHPSPOOL  1
+#define CEPH_POOL_FLAG_HASHPSPOOL      (1ULL << 0) /* hash pg seed and pool id
+                                                      together */
 
 struct ceph_pg_pool_info {
        struct rb_node node;
        s64 id;
-       u8 type;
+       u8 type; /* CEPH_POOL_TYPE_* */
        u8 size;
+       u8 min_size;
        u8 crush_ruleset;
        u8 object_hash;
+       u32 last_force_request_resend;
        u32 pg_num, pgp_num;
        int pg_num_mask, pgp_num_mask;
        s64 read_tier;
        s64 write_tier; /* wins for read+write ops */
-       u64 flags;
+       u64 flags; /* CEPH_POOL_FLAG_* */
        char *name;
 };
 
index 6f84132..7f1cc22 100644 (file)
@@ -66,12 +66,14 @@ static int osdmap_show(struct seq_file *s, void *p)
                   (map->flags & CEPH_OSDMAP_FULL) ?  " FULL" : "");
 
        for (n = rb_first(&map->pg_pools); n; n = rb_next(n)) {
-               struct ceph_pg_pool_info *pool =
+               struct ceph_pg_pool_info *pi =
                        rb_entry(n, struct ceph_pg_pool_info, node);
 
-               seq_printf(s, "pool %lld pg_num %u (%d) read_tier %lld write_tier %lld\n",
-                          pool->id, pool->pg_num, pool->pg_num_mask,
-                          pool->read_tier, pool->write_tier);
+               seq_printf(s, "pool %lld '%s' type %d size %d min_size %d pg_num %u pg_num_mask %d flags 0x%llx lfor %u read_tier %lld write_tier %lld\n",
+                          pi->id, pi->name, pi->type, pi->size, pi->min_size,
+                          pi->pg_num, pi->pg_num_mask, pi->flags,
+                          pi->last_force_request_resend, pi->read_tier,
+                          pi->write_tier);
        }
        for (i = 0; i < map->max_osd; i++) {
                struct ceph_entity_addr *addr = &map->osd_addr[i];
index 3c7dc5e..66c3ebe 100644 (file)
@@ -597,7 +597,9 @@ static int decode_pool(void **p, void *end, struct ceph_pg_pool_info *pi)
        *p += 4;  /* skip crash_replay_interval */
 
        if (ev >= 7)
-               *p += 1;  /* skip min_size */
+               pi->min_size = ceph_decode_8(p);
+       else
+               pi->min_size = pi->size - pi->size / 2;
 
        if (ev >= 8)
                *p += 8 + 8;  /* skip quota_max_* */
@@ -617,6 +619,50 @@ static int decode_pool(void **p, void *end, struct ceph_pg_pool_info *pi)
                pi->write_tier = -1;
        }
 
+       if (ev >= 10) {
+               /* skip properties */
+               num = ceph_decode_32(p);
+               while (num--) {
+                       len = ceph_decode_32(p);
+                       *p += len; /* key */
+                       len = ceph_decode_32(p);
+                       *p += len; /* val */
+               }
+       }
+
+       if (ev >= 11) {
+               /* skip hit_set_params */
+               *p += 1 + 1; /* versions */
+               len = ceph_decode_32(p);
+               *p += len;
+
+               *p += 4; /* skip hit_set_period */
+               *p += 4; /* skip hit_set_count */
+       }
+
+       if (ev >= 12)
+               *p += 4; /* skip stripe_width */
+
+       if (ev >= 13) {
+               *p += 8; /* skip target_max_bytes */
+               *p += 8; /* skip target_max_objects */
+               *p += 4; /* skip cache_target_dirty_ratio_micro */
+               *p += 4; /* skip cache_target_full_ratio_micro */
+               *p += 4; /* skip cache_min_flush_age */
+               *p += 4; /* skip cache_min_evict_age */
+       }
+
+       if (ev >=  14) {
+               /* skip erasure_code_profile */
+               len = ceph_decode_32(p);
+               *p += len;
+       }
+
+       if (ev >= 15)
+               pi->last_force_request_resend = ceph_decode_32(p);
+       else
+               pi->last_force_request_resend = 0;
+
        /* ignore the rest */
 
        *p = pool_end;