mirror of
https://github.com/Zygo/bees.git
synced 2025-08-03 06:13:29 +02:00
Compare commits
9 Commits
extra-trac
...
v0.6.y
Author | SHA1 | Date | |
---|---|---|---|
|
a466ccf2f1 | ||
|
ba04fe1349 | ||
|
830df63d4c | ||
|
20c9d2ff6a | ||
|
7bbb4d14cb | ||
|
363c45b8cd | ||
|
4ec2b8ac16 | ||
|
26d31225fa | ||
|
21ae937201 |
@@ -13,7 +13,7 @@ namespace crucible {
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class ProgressTracker {
|
class ProgressTracker {
|
||||||
class ProgressTrackerState;
|
struct ProgressTrackerState;
|
||||||
class ProgressHolderState;
|
class ProgressHolderState;
|
||||||
public:
|
public:
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
|
@@ -20,6 +20,7 @@ CRUCIBLE_OBJS = \
|
|||||||
uuid.o \
|
uuid.o \
|
||||||
|
|
||||||
include ../makeflags
|
include ../makeflags
|
||||||
|
-include ../localconf
|
||||||
include ../Defines.mk
|
include ../Defines.mk
|
||||||
|
|
||||||
configure.h: configure.h.in
|
configure.h: configure.h.in
|
||||||
|
@@ -124,6 +124,7 @@ namespace crucible {
|
|||||||
} else if (!chatter_names->empty()) {
|
} else if (!chatter_names->empty()) {
|
||||||
cerr << "CRUCIBLE_CHATTER does not list '" << m_file << "' or '" << m_pretty_function << "'" << endl;
|
cerr << "CRUCIBLE_CHATTER does not list '" << m_file << "' or '" << m_pretty_function << "'" << endl;
|
||||||
}
|
}
|
||||||
|
(void)m_line; // not implemented yet
|
||||||
// cerr << "ChatterBox " << reinterpret_cast<void*>(this) << " constructed" << endl;
|
// cerr << "ChatterBox " << reinterpret_cast<void*>(this) << " constructed" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,7 +14,6 @@ namespace crucible {
|
|||||||
// fm_start, fm_length, fm_flags, m_extents
|
// fm_start, fm_length, fm_flags, m_extents
|
||||||
// fe_logical, fe_physical, fe_length, fe_flags
|
// fe_logical, fe_physical, fe_length, fe_flags
|
||||||
|
|
||||||
static const off_t MAX_OFFSET = numeric_limits<off_t>::max();
|
|
||||||
static const off_t FIEMAP_BLOCK_SIZE = 4096;
|
static const off_t FIEMAP_BLOCK_SIZE = 4096;
|
||||||
|
|
||||||
static bool __ew_do_log = getenv("EXTENTWALKER_DEBUG");
|
static bool __ew_do_log = getenv("EXTENTWALKER_DEBUG");
|
||||||
|
@@ -110,9 +110,6 @@ namespace crucible {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
struct ResourceHandle<Process::id, Process>;
|
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
gettid()
|
gettid()
|
||||||
{
|
{
|
||||||
|
@@ -6,6 +6,7 @@ PROGRAMS = \
|
|||||||
all: $(PROGRAMS)
|
all: $(PROGRAMS)
|
||||||
|
|
||||||
include ../makeflags
|
include ../makeflags
|
||||||
|
-include ../localconf
|
||||||
|
|
||||||
LIBS = -lcrucible -lpthread
|
LIBS = -lcrucible -lpthread
|
||||||
LDFLAGS = -L../lib
|
LDFLAGS = -L../lib
|
||||||
|
@@ -11,17 +11,6 @@
|
|||||||
using namespace crucible;
|
using namespace crucible;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static inline
|
|
||||||
const char *
|
|
||||||
getenv_or_die(const char *name)
|
|
||||||
{
|
|
||||||
const char *rv = getenv(name);
|
|
||||||
if (!rv) {
|
|
||||||
THROW_ERROR(runtime_error, "Environment variable " << name << " not defined");
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
BeesFdCache::BeesFdCache()
|
BeesFdCache::BeesFdCache()
|
||||||
{
|
{
|
||||||
m_root_cache.func([&](shared_ptr<BeesContext> ctx, uint64_t root) -> Fd {
|
m_root_cache.func([&](shared_ptr<BeesContext> ctx, uint64_t root) -> Fd {
|
||||||
|
@@ -219,7 +219,6 @@ BeesRoots::transid_max_nocache()
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
sk.nr_items = 1024;
|
sk.nr_items = 1024;
|
||||||
BEESTRACE("transid_max search sk " << sk);
|
|
||||||
sk.do_ioctl(m_ctx->root_fd());
|
sk.do_ioctl(m_ctx->root_fd());
|
||||||
|
|
||||||
if (sk.m_result.empty()) {
|
if (sk.m_result.empty()) {
|
||||||
@@ -416,15 +415,13 @@ BeesRoots::crawl_thread()
|
|||||||
BEESNOTE("tracking transid");
|
BEESNOTE("tracking transid");
|
||||||
auto last_count = m_transid_re.count();
|
auto last_count = m_transid_re.count();
|
||||||
while (true) {
|
while (true) {
|
||||||
BEESTRACE("Measure current transid");
|
// Measure current transid
|
||||||
catch_all([&]() {
|
catch_all([&]() {
|
||||||
BEESTRACE("calling transid_max_nocache");
|
|
||||||
m_transid_re.update(transid_max_nocache());
|
m_transid_re.update(transid_max_nocache());
|
||||||
});
|
});
|
||||||
|
|
||||||
BEESTRACE("Make sure we have a full complement of crawlers");
|
// Make sure we have a full complement of crawlers
|
||||||
catch_all([&]() {
|
catch_all([&]() {
|
||||||
BEESTRACE("calling insert_new_crawl");
|
|
||||||
insert_new_crawl();
|
insert_new_crawl();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -492,24 +489,19 @@ BeesRoots::insert_new_crawl()
|
|||||||
unique_lock<mutex> lock(m_mutex);
|
unique_lock<mutex> lock(m_mutex);
|
||||||
set<uint64_t> excess_roots;
|
set<uint64_t> excess_roots;
|
||||||
for (auto i : m_root_crawl_map) {
|
for (auto i : m_root_crawl_map) {
|
||||||
BEESTRACE("excess_roots.insert(" << i.first << ")");
|
|
||||||
excess_roots.insert(i.first);
|
excess_roots.insert(i.first);
|
||||||
}
|
}
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
while (new_bcs.m_root) {
|
while (new_bcs.m_root) {
|
||||||
BEESTRACE("excess_roots.erase(" << new_bcs.m_root << ")");
|
|
||||||
excess_roots.erase(new_bcs.m_root);
|
excess_roots.erase(new_bcs.m_root);
|
||||||
BEESTRACE("insert_root(" << new_bcs << ")");
|
|
||||||
insert_root(new_bcs);
|
insert_root(new_bcs);
|
||||||
BEESCOUNT(crawl_create);
|
BEESCOUNT(crawl_create);
|
||||||
BEESTRACE("next_root(" << new_bcs.m_root << ")");
|
|
||||||
new_bcs.m_root = next_root(new_bcs.m_root);
|
new_bcs.m_root = next_root(new_bcs.m_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto i : excess_roots) {
|
for (auto i : excess_roots) {
|
||||||
new_bcs.m_root = i;
|
new_bcs.m_root = i;
|
||||||
BEESTRACE("crawl_state_erase(" << new_bcs << ")");
|
|
||||||
crawl_state_erase(new_bcs);
|
crawl_state_erase(new_bcs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -981,7 +973,7 @@ BeesCrawl::fetch_extents()
|
|||||||
// Lock in the old state
|
// Lock in the old state
|
||||||
set_state(old_state);
|
set_state(old_state);
|
||||||
|
|
||||||
BEESTRACE("Searching crawl sk " << static_cast<btrfs_ioctl_search_key&>(sk));
|
BEESTRACE("Searching crawl sk " << sk);
|
||||||
bool ioctl_ok = false;
|
bool ioctl_ok = false;
|
||||||
{
|
{
|
||||||
BEESNOTE("searching crawl sk " << static_cast<btrfs_ioctl_search_key&>(sk));
|
BEESNOTE("searching crawl sk " << static_cast<btrfs_ioctl_search_key&>(sk));
|
||||||
|
14
src/bees.cc
14
src/bees.cc
@@ -204,20 +204,6 @@ BeesNote::get_status()
|
|||||||
|
|
||||||
// static inline helpers ----------------------------------------
|
// static inline helpers ----------------------------------------
|
||||||
|
|
||||||
static inline
|
|
||||||
bool
|
|
||||||
bees_addr_check(uint64_t v)
|
|
||||||
{
|
|
||||||
return !(v & (1ULL << 63));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
bool
|
|
||||||
bees_addr_check(int64_t v)
|
|
||||||
{
|
|
||||||
return !(v & (1ULL << 63));
|
|
||||||
}
|
|
||||||
|
|
||||||
string
|
string
|
||||||
pretty(double d)
|
pretty(double d)
|
||||||
{
|
{
|
||||||
|
@@ -173,7 +173,7 @@ public:
|
|||||||
T at(string idx) const;
|
T at(string idx) const;
|
||||||
|
|
||||||
friend ostream& operator<< <>(ostream &os, const BeesStatTmpl<T> &bs);
|
friend ostream& operator<< <>(ostream &os, const BeesStatTmpl<T> &bs);
|
||||||
friend class BeesStats;
|
friend struct BeesStats;
|
||||||
};
|
};
|
||||||
|
|
||||||
using BeesRates = BeesStatTmpl<double>;
|
using BeesRates = BeesStatTmpl<double>;
|
||||||
|
@@ -14,6 +14,7 @@ test: $(PROGRAMS:%=%.txt) Makefile
|
|||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
include ../makeflags
|
include ../makeflags
|
||||||
|
-include ../localconf
|
||||||
|
|
||||||
LIBS = -lcrucible -lpthread
|
LIBS = -lcrucible -lpthread
|
||||||
LDFLAGS = -L../lib -Wl,-rpath=$(shell realpath ../lib)
|
LDFLAGS = -L../lib -Wl,-rpath=$(shell realpath ../lib)
|
||||||
|
@@ -99,7 +99,7 @@ test_barrier(size_t count)
|
|||||||
oss << "task #" << c;
|
oss << "task #" << c;
|
||||||
Task t(
|
Task t(
|
||||||
oss.str(),
|
oss.str(),
|
||||||
[c, &task_done, &mtx, &cv, bl]() mutable {
|
[c, &task_done, &mtx, bl]() mutable {
|
||||||
// cerr << "Task #" << c << endl;
|
// cerr << "Task #" << c << endl;
|
||||||
unique_lock<mutex> lock(mtx);
|
unique_lock<mutex> lock(mtx);
|
||||||
task_done.at(c) = true;
|
task_done.at(c) = true;
|
||||||
@@ -166,8 +166,9 @@ test_exclusion(size_t count)
|
|||||||
oss << "task #" << c;
|
oss << "task #" << c;
|
||||||
Task t(
|
Task t(
|
||||||
oss.str(),
|
oss.str(),
|
||||||
[c, &only_one, &mtx, &excl, bl]() mutable {
|
[c, &only_one, &excl, bl]() mutable {
|
||||||
// cerr << "Task #" << c << endl;
|
// cerr << "Task #" << c << endl;
|
||||||
|
(void)c;
|
||||||
auto lock = excl.try_lock();
|
auto lock = excl.try_lock();
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
excl.insert_task(Task::current_task());
|
excl.insert_task(Task::current_task());
|
||||||
|
Reference in New Issue
Block a user