OPTION(bluestore_csum_type, OPT_STR, "crc32c")
OPTION(bluestore_min_csum_block, OPT_U32, 4096)
OPTION(bluestore_max_csum_block, OPT_U32, 64*1024)
-OPTION(bluestore_min_alloc_size, OPT_U32, 64*1024)
+OPTION(bluestore_min_alloc_size, OPT_U32, 0)
+OPTION(bluestore_min_alloc_size_hdd, OPT_U32, 64*1024)
+OPTION(bluestore_min_alloc_size_ssd, OPT_U32, 4*1024)
OPTION(bluestore_onode_map_size, OPT_U32, 1024) // onodes per collection
OPTION(bluestore_cache_tails, OPT_BOOL, true) // cache tail blocks in Onode
OPTION(bluestore_kvbackend, OPT_STR, "rocksdb")
std::mutex ioc_reap_lock;
vector<IOContext*> ioc_reap_queue;
std::atomic_int ioc_reap_count = {0};
-public:
+
+protected:
bool rotational;
+
+public:
BlockDevice() = default;
virtual ~BlockDevice() = default;
typedef void (*aio_callback_t)(void *handle, void *aio);
const string& path, aio_callback_t cb, void *cbpriv);
virtual bool supported_bdev_label() { return true; }
virtual bool is_rotational() { return rotational; }
+
virtual void aio_submit(IOContext *ioc) = 0;
virtual uint64_t get_size() const = 0;
kv_stop(false),
logger(NULL),
csum_type(bluestore_blob_t::CSUM_CRC32C),
- min_alloc_size(g_conf->bluestore_min_alloc_size)
+ min_alloc_size(0)
{
_init_logger();
}
static const char* KEYS[] = {
"bluestore_csum",
"bluestore_csum_type",
- "bluestore_min_alloc_size",
NULL
};
return KEYS;
<< bluestore_blob_t::get_csum_type_string(csum_type)
<< dendl;
}
- if (changed.count("bluestore_min_alloc_size")) {
- min_alloc_size = g_conf->bluestore_min_alloc_size;
- dout(10) << __func__ << " min_alloc_size 0x" << std::hex << min_alloc_size
- << std::dec << dendl;
- }
}
void BlueStore::_init_logger()
return 0;
}
+void BlueStore::_set_min_alloc(void)
+{
+ /*
+ * Set device block size according to its media
+ */
+ if (g_conf->bluestore_min_alloc_size) {
+ min_alloc_size = g_conf->bluestore_min_alloc_size;
+ } else {
+ assert(bdev);
+ if (bdev->is_rotational()) {
+ min_alloc_size = g_conf->bluestore_min_alloc_size_hdd;
+ } else {
+ min_alloc_size = g_conf->bluestore_min_alloc_size_ssd;
+ }
+ }
+
+ dout(10) << __func__ << " min_alloc_size 0x" << std::hex << min_alloc_size
+ << std::dec << dendl;
+}
+
int BlueStore::_open_bdev(bool create)
{
bluestore_bdev_label_t label;
for (uint64_t t = 1; t < block_size; t <<= 1) {
++block_size_order;
}
+
+ _set_min_alloc();
return 0;
fail_close:
int _read_fsid(uuid_d *f);
int _write_fsid();
void _close_fsid();
+ void _set_min_alloc();
int _open_bdev(bool create);
void _close_bdev();
int _open_db(bool create);
{
zeros = buffer::create_page_aligned(1048576);
zeros.zero();
+ rotational = true;
}
int KernelDevice::_lock()