mirror of
https://github.com/ceph/ceph
synced 2025-02-21 01:47:25 +00:00
Merge branch 'wip-bluestore'
This commit is contained in:
commit
f8ea3eb6c0
@ -345,20 +345,17 @@ static int get_key_object(const string& key, ghobject_t *oid)
|
||||
int r;
|
||||
const char *p = key.c_str();
|
||||
|
||||
p = _key_decode_shard(p, &oid->shard_id);
|
||||
if (!*p)
|
||||
if (key.length() < 2 + 8 + 4)
|
||||
return -2;
|
||||
p = _key_decode_shard(p, &oid->shard_id);
|
||||
|
||||
uint64_t pool;
|
||||
p = _key_decode_u64(p, &pool);
|
||||
if (!*p)
|
||||
return -3;
|
||||
oid->hobj.pool = pool - 0x8000000000000000ull;
|
||||
|
||||
unsigned hash;
|
||||
p = _key_decode_u32(p, &hash);
|
||||
if (!*p)
|
||||
return -4;
|
||||
|
||||
oid->hobj.set_bitwise_key_u32(hash);
|
||||
if (*p != '.')
|
||||
return -5;
|
||||
@ -395,8 +392,6 @@ static int get_key_object(const string& key, ghobject_t *oid)
|
||||
}
|
||||
|
||||
p = _key_decode_u64(p, &oid->hobj.snap.val);
|
||||
if (!*p)
|
||||
return -11;
|
||||
p = _key_decode_u64(p, &oid->generation);
|
||||
if (*p) {
|
||||
// if we get something other than a null terminator here,
|
||||
|
@ -77,7 +77,7 @@ void FreelistManager::shutdown()
|
||||
|
||||
void FreelistManager::dump()
|
||||
{
|
||||
Mutex::Locker l(lock);
|
||||
std::lock_guard<std::mutex> l(lock);
|
||||
_dump();
|
||||
}
|
||||
|
||||
@ -94,7 +94,6 @@ void FreelistManager::_dump()
|
||||
|
||||
void FreelistManager::_audit()
|
||||
{
|
||||
assert(lock.is_locked());
|
||||
uint64_t sum = 0;
|
||||
for (auto& p : kv_free) {
|
||||
sum += p.second;
|
||||
@ -111,7 +110,7 @@ int FreelistManager::allocate(
|
||||
uint64_t offset, uint64_t length,
|
||||
KeyValueDB::Transaction txn)
|
||||
{
|
||||
Mutex::Locker l(lock);
|
||||
std::lock_guard<std::mutex> l(lock);
|
||||
dout(10) << __func__ << " " << offset << "~" << length << dendl;
|
||||
total_free -= length;
|
||||
auto p = kv_free.lower_bound(offset);
|
||||
@ -184,7 +183,7 @@ int FreelistManager::release(
|
||||
uint64_t offset, uint64_t length,
|
||||
KeyValueDB::Transaction txn)
|
||||
{
|
||||
Mutex::Locker l(lock);
|
||||
std::lock_guard<std::mutex> l(lock);
|
||||
dout(10) << __func__ << " " << offset << "~" << length << dendl;
|
||||
total_free += length;
|
||||
auto p = kv_free.lower_bound(offset);
|
||||
|
@ -6,13 +6,13 @@
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <ostream>
|
||||
#include "common/Mutex.h"
|
||||
#include "kv/KeyValueDB.h"
|
||||
|
||||
class FreelistManager {
|
||||
std::string prefix;
|
||||
Mutex lock;
|
||||
std::mutex lock;
|
||||
uint64_t total_free;
|
||||
|
||||
std::map<uint64_t, uint64_t> kv_free; ///< mirrors our kv values in the db
|
||||
@ -22,7 +22,6 @@ class FreelistManager {
|
||||
|
||||
public:
|
||||
FreelistManager() :
|
||||
lock("FreelistManager::lock"),
|
||||
total_free(0) {
|
||||
}
|
||||
|
||||
@ -32,7 +31,7 @@ public:
|
||||
void dump();
|
||||
|
||||
uint64_t get_total_free() {
|
||||
Mutex::Locker l(lock);
|
||||
std::lock_guard<std::mutex> l(lock);
|
||||
return total_free;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user