mirror of
https://github.com/ceph/ceph
synced 2025-01-03 17:42:36 +00:00
librados: add calls to expose required write alignment
Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
parent
4c1338f457
commit
211fc4e17c
@ -500,6 +500,9 @@ namespace librados
|
||||
|
||||
std::string get_pool_name();
|
||||
|
||||
bool pool_requires_alignment();
|
||||
uint64_t pool_required_alignment();
|
||||
|
||||
// create an object
|
||||
int create(const std::string& oid, bool exclusive);
|
||||
int create(const std::string& oid, bool exclusive, const std::string& category);
|
||||
|
@ -122,6 +122,20 @@ int64_t librados::RadosClient::lookup_pool(const char *name)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool librados::RadosClient::pool_requires_alignment(int64_t pool_id)
|
||||
{
|
||||
Mutex::Locker l(lock);
|
||||
return osdmap.have_pg_pool(pool_id) &&
|
||||
osdmap.get_pg_pool(pool_id)->requires_aligned_append();
|
||||
}
|
||||
|
||||
uint64_t librados::RadosClient::pool_required_alignment(int64_t pool_id)
|
||||
{
|
||||
Mutex::Locker l(lock);
|
||||
return osdmap.have_pg_pool(pool_id) ?
|
||||
osdmap.get_pg_pool(pool_id)->required_alignment() : 0;
|
||||
}
|
||||
|
||||
const char *librados::RadosClient::get_pool_name(int64_t pool_id)
|
||||
{
|
||||
Mutex::Locker l(lock);
|
||||
|
@ -99,6 +99,8 @@ public:
|
||||
int get_fsid(std::string *s);
|
||||
int64_t lookup_pool(const char *name);
|
||||
const char *get_pool_name(int64_t pool_id);
|
||||
bool pool_requires_alignment(int64_t pool_id);
|
||||
uint64_t pool_required_alignment(int64_t pool_id);
|
||||
int pool_get_auid(uint64_t pool_id, unsigned long long *auid);
|
||||
int pool_get_name(uint64_t pool_id, std::string *auid);
|
||||
|
||||
|
@ -724,6 +724,16 @@ int librados::IoCtx::get_auid(uint64_t *auid_)
|
||||
return rados_ioctx_pool_get_auid(io_ctx_impl, auid_);
|
||||
}
|
||||
|
||||
bool librados::IoCtx::pool_requires_alignment()
|
||||
{
|
||||
return io_ctx_impl->client->pool_requires_alignment(get_id());
|
||||
}
|
||||
|
||||
uint64_t librados::IoCtx::pool_required_alignment()
|
||||
{
|
||||
return io_ctx_impl->client->pool_required_alignment(get_id());
|
||||
}
|
||||
|
||||
std::string librados::IoCtx::get_pool_name()
|
||||
{
|
||||
std::string s;
|
||||
|
@ -897,6 +897,9 @@ public:
|
||||
bool is_replicated() const { return get_type() == TYPE_REPLICATED; }
|
||||
bool is_erasure() const { return get_type() == TYPE_ERASURE; }
|
||||
|
||||
bool requires_aligned_append() const { return is_erasure(); }
|
||||
uint64_t required_alignment() const { return stripe_width; }
|
||||
|
||||
bool can_shift_osds() const {
|
||||
switch (get_type()) {
|
||||
case TYPE_REPLICATED:
|
||||
|
Loading…
Reference in New Issue
Block a user