1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-18 05:45:45 +02:00

roots: use symbolic names for SCAN_MODEs

This was done on the development branch three years ago, and
has been creating annoying merge conflicts ever since.  Sync
up the branches so they have the same names for these.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell 2018-10-24 01:43:22 -04:00
parent f98599407f
commit 7cef1133be
3 changed files with 13 additions and 15 deletions

View File

@ -54,10 +54,9 @@ string
BeesRoots::scan_mode_ntoa(BeesRoots::ScanMode mode)
{
static const bits_ntoa_table table[] = {
NTOA_TABLE_ENTRY_ENUM(SCAN_MODE_ZERO),
NTOA_TABLE_ENTRY_ENUM(SCAN_MODE_ONE),
NTOA_TABLE_ENTRY_ENUM(SCAN_MODE_TWO),
NTOA_TABLE_ENTRY_ENUM(SCAN_MODE_COUNT),
{ .n = SCAN_MODE_LOCKSTEP, .mask = ~0ULL, .a = "lockstep" },
{ .n = SCAN_MODE_INDEPENDENT, .mask = ~0ULL, .a = "independent" },
{ .n = SCAN_MODE_SEQUENTIAL, .mask = ~0ULL, .a = "sequential" },
NTOA_TABLE_ENTRY_END()
};
return bits_ntoa(mode, table);
@ -269,8 +268,8 @@ BeesRoots::crawl_roots()
switch (m_scan_mode) {
case SCAN_MODE_ZERO: {
// Scan the same inode/offset tuple in each subvol (good for snapshots)
case SCAN_MODE_LOCKSTEP: {
// Scan the same inode/offset tuple in each subvol (bad for locking)
BeesFileRange first_range;
shared_ptr<BeesCrawl> first_crawl;
for (auto i : crawl_map_copy) {
@ -301,7 +300,7 @@ BeesRoots::crawl_roots()
break;
}
case SCAN_MODE_ONE: {
case SCAN_MODE_INDEPENDENT: {
// Scan each subvol one extent at a time (good for continuous forward progress)
size_t batch_count = 0;
for (auto i : crawl_map_copy) {
@ -315,7 +314,7 @@ BeesRoots::crawl_roots()
break;
}
case SCAN_MODE_TWO: {
case SCAN_MODE_SEQUENTIAL: {
// Scan oldest crawl first (requires maximum amount of temporary space)
vector<shared_ptr<BeesCrawl>> crawl_vector;
for (auto i : crawl_map_copy) {

View File

@ -601,7 +601,7 @@ bees_main(int argc, char *argv[])
unsigned thread_min = 0;
double load_target = 0;
bool workaround_btrfs_send = false;
BeesRoots::ScanMode root_scan_mode = BeesRoots::SCAN_MODE_ZERO;
BeesRoots::ScanMode root_scan_mode = BeesRoots::SCAN_MODE_LOCKSTEP;
// Configure getopt_long
static const struct option long_options[] = {

View File

@ -594,12 +594,11 @@ public:
Fd open_root_ino(const BeesFileId &bfi) { return open_root_ino(bfi.root(), bfi.ino()); }
bool is_root_ro(uint64_t root);
// TODO: think of better names for these.
// or TODO: do extent-tree scans instead
// TODO: do extent-tree scans instead
enum ScanMode {
SCAN_MODE_ZERO,
SCAN_MODE_ONE,
SCAN_MODE_TWO,
SCAN_MODE_LOCKSTEP,
SCAN_MODE_INDEPENDENT,
SCAN_MODE_SEQUENTIAL,
SCAN_MODE_COUNT, // must be last
};
@ -607,7 +606,7 @@ public:
void set_workaround_btrfs_send(bool do_avoid);
private:
ScanMode m_scan_mode = SCAN_MODE_ZERO;
ScanMode m_scan_mode = SCAN_MODE_LOCKSTEP;
static string scan_mode_ntoa(ScanMode new_mode);
};