Old code assumes that fl_pg_pool == 0 means the pool is not defined, while
file_layout_t uses -1. Translate between the two.
Note that this means a valid file_layout_t with pool_id == 0 cannot be
accurately translated to a legacy file_layout_t. That is somewhat
unavoidable, and should not be a problem since real clusters create 'rbd'
as pool 0 and it does not use any file layouts.
Signed-off-by: Sage Weil <sage@redhat.com>
stripe_count = fl.fl_stripe_count;
object_size = fl.fl_object_size;
pool_id = (int32_t)fl.fl_pg_pool;
+ // in the legacy encoding, pool 0 was undefined.
+ if (pool_id == 0)
+ pool_id = -1;
pool_ns.clear();
}
fl->fl_cas_hash = 0;
fl->fl_object_stripe_unit = 0;
fl->fl_unused = 0;
- fl->fl_pg_pool = pool_id;
+ // in the legacy encoding, pool 0 was undefined.
+ if (pool_id >= 0)
+ fl->fl_pg_pool = pool_id;
+ else
+ fl->fl_pg_pool = 0;
}
void file_layout_t::encode(bufferlist& bl, uint64_t features) const