mirror of
https://github.com/ceph/ceph
synced 2024-12-18 01:16:55 +00:00
Merge pull request #13390 from Liuchang0812/remove-header
os/bluestore: some cleanup Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
commit
3cbe67f436
@ -13,7 +13,6 @@
|
||||
#define CEPH_OS_BLUESTORE_ALLOCATOR_H
|
||||
|
||||
#include <ostream>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include "include/assert.h"
|
||||
#include "os/bluestore/bluestore_types.h"
|
||||
|
||||
|
@ -29,24 +29,24 @@ public:
|
||||
BitMapAllocator(CephContext* cct, int64_t device_size, int64_t block_size);
|
||||
~BitMapAllocator();
|
||||
|
||||
int reserve(uint64_t need);
|
||||
void unreserve(uint64_t unused);
|
||||
int reserve(uint64_t need) override;
|
||||
void unreserve(uint64_t unused) override;
|
||||
|
||||
int64_t allocate(
|
||||
uint64_t want_size, uint64_t alloc_unit, uint64_t max_alloc_size,
|
||||
int64_t hint, mempool::bluestore_alloc::vector<AllocExtent> *extents);
|
||||
int64_t hint, mempool::bluestore_alloc::vector<AllocExtent> *extents) override;
|
||||
|
||||
int release(
|
||||
uint64_t offset, uint64_t length);
|
||||
uint64_t offset, uint64_t length) override;
|
||||
|
||||
uint64_t get_free();
|
||||
uint64_t get_free() override;
|
||||
|
||||
void dump() override;
|
||||
|
||||
void init_add_free(uint64_t offset, uint64_t length);
|
||||
void init_rm_free(uint64_t offset, uint64_t length);
|
||||
void init_add_free(uint64_t offset, uint64_t length) override;
|
||||
void init_rm_free(uint64_t offset, uint64_t length) override;
|
||||
|
||||
void shutdown();
|
||||
void shutdown() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,7 @@
|
||||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
|
||||
// vim: ts=8 sw=2 smarttab
|
||||
|
||||
#include "boost/algorithm/string.hpp"
|
||||
#include "BlueFS.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
@ -8,6 +9,7 @@
|
||||
#include "common/perf_counters.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "Allocator.h"
|
||||
#include "include/assert.h"
|
||||
|
||||
#define dout_context cct
|
||||
#define dout_subsys ceph_subsys_bluefs
|
||||
@ -1917,9 +1919,9 @@ int BlueFS::open_for_write(
|
||||
// match up with bluestore. the slow device is always the second
|
||||
// one (when a dedicated block.db device is present and used at
|
||||
// bdev 0). the wal device is always last.
|
||||
if (strcmp(dirname.c_str() + dirname.length() - 5, ".slow") == 0) {
|
||||
if (boost::algorithm::ends_with(filename, ".slow")) {
|
||||
file->fnode.prefer_bdev = BlueFS::BDEV_SLOW;
|
||||
} else if (strcmp(dirname.c_str() + dirname.length() - 4, ".wal") == 0) {
|
||||
} else if (boost::algorithm::ends_with(dirname, ".wal")) {
|
||||
file->fnode.prefer_bdev = BlueFS::BDEV_WAL;
|
||||
}
|
||||
}
|
||||
@ -1932,12 +1934,12 @@ int BlueFS::open_for_write(
|
||||
|
||||
*h = _create_writer(file);
|
||||
|
||||
if (0 == filename.compare(filename.length() - 4, 4, ".log")) {
|
||||
if (boost::algorithm::ends_with(filename, ".log")) {
|
||||
(*h)->writer_type = BlueFS::WRITER_WAL;
|
||||
if (logger && !overwrite) {
|
||||
logger->inc(l_bluefs_files_written_wal);
|
||||
}
|
||||
} else if (0 == filename.compare(filename.length() - 4, 4, ".sst")) {
|
||||
} else if (boost::algorithm::ends_with(filename, ".sst")) {
|
||||
(*h)->writer_type = BlueFS::WRITER_SST;
|
||||
if (logger) {
|
||||
logger->inc(l_bluefs_files_written_sst);
|
||||
@ -2177,7 +2179,7 @@ int BlueFS::readdir(const string& dirname, vector<string> *ls)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(lock);
|
||||
dout(10) << __func__ << " " << dirname << dendl;
|
||||
if (dirname.size() == 0) {
|
||||
if (dirname.empty()) {
|
||||
// list dirs
|
||||
ls->reserve(dir_map.size() + 2);
|
||||
for (auto& q : dir_map) {
|
||||
|
@ -28,28 +28,28 @@ public:
|
||||
StupidAllocator(CephContext* cct);
|
||||
~StupidAllocator();
|
||||
|
||||
int reserve(uint64_t need);
|
||||
void unreserve(uint64_t unused);
|
||||
int reserve(uint64_t need) override;
|
||||
void unreserve(uint64_t unused) override;
|
||||
|
||||
int64_t allocate(
|
||||
uint64_t want_size, uint64_t alloc_unit, uint64_t max_alloc_size,
|
||||
int64_t hint, mempool::bluestore_alloc::vector<AllocExtent> *extents);
|
||||
int64_t hint, mempool::bluestore_alloc::vector<AllocExtent> *extents) override;
|
||||
|
||||
int64_t allocate_int(
|
||||
uint64_t want_size, uint64_t alloc_unit, int64_t hint,
|
||||
uint64_t *offset, uint32_t *length);
|
||||
|
||||
int release(
|
||||
uint64_t offset, uint64_t length);
|
||||
uint64_t offset, uint64_t length) override;
|
||||
|
||||
uint64_t get_free();
|
||||
uint64_t get_free() override;
|
||||
|
||||
void dump() override;
|
||||
|
||||
void init_add_free(uint64_t offset, uint64_t length);
|
||||
void init_rm_free(uint64_t offset, uint64_t length);
|
||||
void init_add_free(uint64_t offset, uint64_t length) override;
|
||||
void init_rm_free(uint64_t offset, uint64_t length) override;
|
||||
|
||||
void shutdown();
|
||||
void shutdown() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -5,6 +5,7 @@
|
||||
* Author: Ramesh Chander, Ramesh.Chander@sandisk.com
|
||||
*/
|
||||
#include <iostream>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "common/Mutex.h"
|
||||
|
Loading…
Reference in New Issue
Block a user