From ff57dd420ec4055d7e85de9c660c907ebe2dd5cc Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 10 Nov 2019 15:17:21 +0300 Subject: [PATCH] Rename object_db to clean_db --- blockstore.h | 2 +- blockstore_init.cpp | 2 +- blockstore_read.cpp | 6 +++--- blockstore_stable.cpp | 8 ++++---- blockstore_write.cpp | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/blockstore.h b/blockstore.h index 6c59d4ed..96b6af17 100644 --- a/blockstore.h +++ b/blockstore.h @@ -229,7 +229,7 @@ class blockstore struct ring_consumer_t ring_consumer; // Another option is https://github.com/algorithm-ninja/cpp-btree - spp::sparse_hash_map object_db; + spp::sparse_hash_map clean_db; std::map dirty_db; std::list submit_queue; std::deque unsynced_big_writes, unsynced_small_writes; diff --git a/blockstore_init.cpp b/blockstore_init.cpp index c9f02602..199ccc6c 100644 --- a/blockstore_init.cpp +++ b/blockstore_init.cpp @@ -75,7 +75,7 @@ void blockstore_init_meta::handle_entries(struct clean_disk_entry* entries, int if (entries[i].oid.inode > 0) { allocator_set(bs->data_alloc, done_cnt+i, true); - bs->object_db[entries[i].oid] = (struct clean_entry){ + bs->clean_db[entries[i].oid] = (struct clean_entry){ entries[i].version, (uint32_t)(entries[i].flags ? ST_CURRENT : ST_D_META_SYNCED), done_cnt+i diff --git a/blockstore_read.cpp b/blockstore_read.cpp index 625ab138..c7b975d1 100644 --- a/blockstore_read.cpp +++ b/blockstore_read.cpp @@ -71,13 +71,13 @@ int blockstore::fulfill_read(blockstore_operation *read_op, uint32_t item_start, int blockstore::dequeue_read(blockstore_operation *read_op) { - auto clean_it = object_db.find(read_op->oid); + auto clean_it = clean_db.find(read_op->oid); auto dirty_it = dirty_db.upper_bound((obj_ver_id){ .oid = read_op->oid, .version = UINT64_MAX, }); dirty_it--; - bool clean_found = clean_it != object_db.end(); + bool clean_found = clean_it != clean_db.end(); bool dirty_found = (dirty_it != dirty_db.end() && dirty_it->first.oid == read_op->oid); if (!clean_found && !dirty_found) { @@ -107,7 +107,7 @@ int blockstore::dequeue_read(blockstore_operation *read_op) dirty_it--; } } - if (clean_it != object_db.end()) + if (clean_it != clean_db.end()) { if (!fulfill_read(read_op, 0, block_size, ST_CURRENT, 0, clean_it->second.location)) { diff --git a/blockstore_stable.cpp b/blockstore_stable.cpp index bbec44f4..6a5164c5 100644 --- a/blockstore_stable.cpp +++ b/blockstore_stable.cpp @@ -8,8 +8,8 @@ int blockstore::dequeue_stable(blockstore_operation *op) }); if (dirty_it == dirty_db.end()) { - auto clean_it = object_db.find(op->oid); - if (clean_it == object_db.end() || clean_it->second.version < op->version) + auto clean_it = clean_db.find(op->oid); + if (clean_it == clean_db.end() || clean_it->second.version < op->version) { // No such object version op->retval = EINVAL; @@ -116,7 +116,7 @@ void blockstore::handle_stable_event(ring_data_t *data, blockstore_operation *op dirty_it->second.state = ST_J_STABLE; // Copy data from the journal to the data device // -> increase version on the metadata device - // -> advance object_db entry's version and clear previous journal entries + // -> advance clean_db entry's version and clear previous journal entries // This makes 1 4K small write look like: // 512b+4K (journal) + sync + 512b (journal) + sync + 512b (metadata) + 4K (data) + sync. // WA = 2.375. It's not the best, SSD FTL-like redirect-write with defragmentation @@ -127,7 +127,7 @@ void blockstore::handle_stable_event(ring_data_t *data, blockstore_operation *op { dirty_it->second.state = ST_D_STABLE; // Copy metadata from the journal to the metadata device - // -> move dirty_db entry to object_db and clear previous journal entries + // -> move dirty_db entry to clean_db and clear previous journal entries // This makes 1 128K big write look like: // 128K (data) + sync + 512b (journal) + sync + 512b (journal) + sync + 512b (metadata) + sync. // WA = 1.012. Very good :) diff --git a/blockstore_write.cpp b/blockstore_write.cpp index 168cbaa0..fa34410c 100644 --- a/blockstore_write.cpp +++ b/blockstore_write.cpp @@ -14,8 +14,8 @@ void blockstore::enqueue_write(blockstore_operation *op) } else { - auto clean_it = object_db.find(op->oid); - if (clean_it != object_db.end()) + auto clean_it = clean_db.find(op->oid); + if (clean_it != clean_db.end()) { op->version = clean_it->second.version + 1; }