vitastor/blockstore_init.h

52 lines
1.4 KiB
C
Raw Normal View History

2019-11-03 22:04:25 +03:00
#pragma once
class blockstore_init_meta
{
blockstore *bs;
int wait_state = 0, wait_count = 0;
2019-11-04 01:42:40 +03:00
uint8_t *metadata_buffer = NULL;
2019-11-03 22:04:25 +03:00
uint64_t metadata_read = 0;
int prev = 0, prev_done = 0, done_len = 0, submitted = 0;
uint64_t done_cnt = 0;
uint64_t entries_loaded = 0;
struct io_uring_sqe *sqe;
struct ring_data_t *data;
void handle_entries(struct clean_disk_entry* entries, int count, int block_order);
void handle_event(ring_data_t *data);
2019-11-03 22:04:25 +03:00
public:
2019-11-05 02:43:21 +03:00
blockstore_init_meta(blockstore *bs);
int loop();
2019-11-03 22:04:25 +03:00
};
2019-11-30 23:32:10 +03:00
struct bs_init_journal_done
{
void *buf;
uint64_t pos, len;
};
2019-11-03 22:04:25 +03:00
class blockstore_init_journal
{
blockstore *bs;
2019-11-30 23:32:10 +03:00
int wait_state = 0, wait_count = 0, handle_res = 0;
uint64_t entries_loaded = 0;
2019-11-04 01:42:40 +03:00
uint32_t crc32_last = 0;
bool started = false;
uint64_t next_free = 512;
2019-11-30 23:32:10 +03:00
std::vector<bs_init_journal_done> done;
uint64_t journal_pos = 0;
uint64_t continue_pos = 0;
void *init_write_buf = NULL;
uint64_t init_write_sector = 0;
2019-11-04 15:46:33 +03:00
bool wrapped = false;
2019-11-30 23:32:10 +03:00
void *submitted_buf;
struct io_uring_sqe *sqe;
struct ring_data_t *data;
journal_entry_start *je_start;
2019-11-19 20:03:19 +03:00
std::function<void(ring_data_t*)> simple_callback;
2019-11-30 23:32:10 +03:00
int handle_journal_part(void *buf, uint64_t done_pos, uint64_t len);
void handle_event(ring_data_t *data);
2019-11-03 22:04:25 +03:00
public:
blockstore_init_journal(blockstore* bs);
2019-11-05 02:43:21 +03:00
int loop();
2019-11-03 22:04:25 +03:00
};