29 #define _FILE_OFFSET_BITS 64 43 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_BE 58 #include "format/format_xc.h" 323 static int init(
void);
324 static void fini(
void);
328 static int get (
struct scanner *
s,
void *
buf,
size_t nob);
374 const struct m0_fid *fid1);
379 static void qinit(
struct queue *
q, uint64_t maxnr);
391 static void test(
void);
407 uint64_t partitions_nr);
421 #define _FT(name) M0_FORMAT_TYPE_ ## name 422 #define _TAG(name) M0_ ## name ## _FORMAT_VERSION , _FT(name) 423 #define _T(name, str, field, ops) [_FT(name)] = { \ 424 .r_tag = { _TAG(name), { offsetof(struct str, field) } }, \ 457 #define _B(t, proc) [t] = { .b_type = (t), .b_proc = (proc) } 541 .bqc_producers_nr_max = 1,
543 .tbc_workers_nr = 0x40,
544 .tbc_partitions_nr =
AO_NR,
545 .tbc_work_items_per_tx_max = 1,
547 #define FLOG(level, rc, s) \ 548 M0_LOG(level, " rc=%d at offset: %" PRId64 " errno: %s (%i), eof: %i", \ 549 (rc), (uint64_t)ftell(s->s_file), strerror(errno), \ 550 errno, feof(s->s_file)) 552 #define RLOG(level, prefix, s, r, tag) \ 553 M0_LOG(level, prefix " %" PRIu64 " %s %hu:%hu:%u", s->s_off, recname(r), \ 554 (tag)->ot_version, (tag)->ot_type, (tag)->ot_size) 558 printf(
"Caught Signal %d \n",
num);
562 int main(
int argc,
char **argv)
565 const char *spath =
NULL;
569 bool print_gen_id =
false;
579 errx(EX_CONFIG,
"Cannot initialise motr: %d.", result);
582 errx(EX_CONFIG,
"Cannot initialise beck: %d.", result);
585 errx(EX_CONFIG,
"Cannot initialise scanner: %d.", result);
590 LAMBDA(
void, (
const char *path) {
595 M0_FLAGARG(
'b',
"Scan every byte (10x slower).",
602 LAMBDA(
void, (
const char *fname) {
605 M0_FLAGARG(
'p',
"Print Generation Identifier.",
624 M0_FLAGARG(
'm',
"MMAP BE segment file. Useful for " 627 errx(EX_USAGE,
"Wrong option: %d.", result);
641 printf(
"Running in read-only mode.\n");
644 printf(
"Will not print INVALID GOB IDs if found since '-e'" 645 "option was not specified. \n");
648 errx(EX_USAGE,
"Specify domain path (-d).");
650 sfd = open(spath, O_RDONLY);
652 err(EX_NOINPUT,
"Cannot open snapshot \"%s\".", spath);
656 err(EX_NOINPUT,
"Cannot open snapshot.");
660 err(EX_NOINPUT,
"Cannot seek snapshot to the end.");
664 err(EX_NOINPUT,
"Cannot tell snapshot size.");
667 err(EX_NOINPUT,
"Cannot seek snapshot to the beginning.");
674 err(EX_NOINPUT,
"Failed to open yaml file \"%s\".",
688 printf(
"\nReceived source segment header generation id\n");
695 printf(
"\nSource segment header generation id to be used by beck.\n");
704 printf(
"Cannot find any segment header generation identifer");
709 errx(EX_USAGE,
"Specify file to save scan offsets (-r).");
716 err(EX_CONFIG,
"Cannot start scanner thread.");
730 err(EX_CONFIG,
"Cannot initialise builder.");
734 err(EX_CONFIG,
"scan offset save/restore init failure");
749 PROT_READ|PROT_WRITE,
750 MAP_FIXED | MAP_PRIVATE | MAP_NORESERVE,
754 if (ret == MAP_FAILED)
755 err(EXIT_FAILURE,
"Failed to mmap memory. Error");
757 printf(
"BE segment file %s has been mmaped at " 758 "address %p for %" PRId64 " bytes.\n" 759 "Please attach to process %u to browse BE " 770 err(EX_CONFIG,
"Cannot initialise scanner.");
772 printf(
"Press CTRL+C to quit.\n");
776 printf(
"\n Pending to process bnodes=%"PRIu64 " It may take some time",
784 warn(
"Scan failed: %d.", result);
814 b = &
bt[
node.bt_backlink.bli_type];
830 localtime_r(&ts, &tm);
831 printf(
"%04d-%02d-%02d-%02d:%02d:%02d.%09" PRIu64 " (%" PRIu64 ")",
832 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
833 tm.tm_hour, tm.tm_min, tm.tm_sec,
842 const char *rt_be_cksum;
845 old_offset = ftello(
fp);
846 fseeko(
fp, 0, SEEK_SET);
848 if (fread(&seg_hdr, 1,
sizeof(seg_hdr),
fp) ==
sizeof(seg_hdr)) {
859 bi_xcode_protocol_be_checksum;
869 fseeko(
fp, old_offset, SEEK_SET);
880 printf(
"Checksum error for segment header. " 881 "Could not extract Generation ID.\n");
905 printf(
"Checksum error for segment header. " 906 "Could not extract Segment map information. " 907 "Using possible defaults\n");
922 else if (
s->s_gen_found)
924 else if (
gen >
s->s_gen &&
947 rc = fseeko(
s->s_file, 0, SEEK_SET);
952 rc =
getat(
s, 0,
s->s_chunk,
sizeof s->s_chunk);
967 time_t lasttime = time(
NULL);
970 uint64_t lastrecord = 0;
971 uint64_t lastdata = 0;
975 printf(
"Resuming Scan from Offset = %li file %s",
979 lastnvsaveoff =
s->s_off;
985 }
else if (
s->s_byte)
986 s->s_off -=
sizeof magic - 1;
990 printf(
"\nOffset: %15lli Speed: %7.2f MB/s " 992 "Action: %" PRIu64 " records/s " 993 "Data Speed: %7.2f MB/s",
995 ((
double)
s->s_off - lastoff) /
996 DELTA / 1024.0 / 1024.0,
997 (
int)(
s->s_off * 100 /
s->s_size),
1000 DELTA / 1024.0 / 1024.0);
1001 lasttime = time(
NULL);
1011 (
s->s_off - lastnvsaveoff >
1015 lastnvsaveoff =
s->s_off;
1019 return feof(
s->s_file) ? 0 : result;
1026 printf(
"\n%25s : %9s %9s %9s %9s\n",
1027 "record",
"found",
"bad csum",
"unaligned",
"version");
1036 printf(
"\n%25s : %9s %9s %9s %9s %9s %9s %9s\n",
1037 "btree",
"tree",
"node",
"leaf",
"maxlevel",
"kv",
"bad kv",
1046 s->c_tree,
s->c_node,
s->c_leaf,
s->c_maxlevel,
1047 s->c_kv,
s->c_kv_bad,
s->c_fanout);
1050 printf(
"\ngenerations\n");
1052 if (
g[
i].g_count > 0) {
1054 printf(
" : %9" PRId64 "\n",
g[
i].g_count);
1067 result =
get(
s, &hdr,
sizeof hdr);
1079 r->r_stats.s_found++;
1080 r->r_stats.s_align[!!(
s->s_off & 07)]++;
1086 s->s_off -=
sizeof hdr;
1096 return M0_RC(result);
1104 const char fprefix[] =
"M0_FORMAT_TYPE_";
1105 const char bprefix[] =
"M0_BBT_";
1111 ergo(
rt[
i].r_tag.ot_type != 0,
1114 if (
rt[
i].r_tag.ot_type == 0)
1118 for (j = 0; j < e->
xe_nr; ++j) {
1120 sizeof fprefix - 1) == 0);
1129 e = &m0_xc_m0_be_btree_type_enum;
1131 if (
bt[
i].b_type == 0)
1134 for (j = 0; j < e->
xe_nr; ++j) {
1136 sizeof bprefix - 1) == 0);
1160 return M0_RC(-EINVAL);
1165 if (memcmp(
tag, &
r->r_tag,
sizeof *
tag) == 0) {
1173 if (
r->r_ops !=
NULL &&
r->r_ops->ro_check !=
NULL) {
1174 result =
r->r_ops->ro_check(
s,
r,
buf);
1177 return M0_RC(result);
1182 r->r_stats.s_chksum++;
1185 if (
r->r_ops !=
NULL &&
1186 r->r_ops->ro_proc !=
NULL)
1187 result =
r->r_ops->ro_proc(
s,
r,
buf);
1192 r->r_stats.s_version++;
1193 if (
r->r_ops !=
NULL &&
r->r_ops->ro_ver !=
NULL)
1194 result =
r->r_ops->ro_ver(
s,
r,
buf);
1197 return M0_RC(result);
1213 FILE *
f =
s->s_file;
1216 if (off !=
s->s_pos)
1217 result = fseeko(
f, off, SEEK_SET);
1221 }
else if (fread(
buf, 1, nob,
f) != nob) {
1231 s->s_pos = off + nob;
1234 if (result != 0 && !feof(
f)) {
1239 return M0_RC(result);
1244 off_t off =
addr -
s->s_seg->bs_addr;
1256 s->s_start_off =
s->s_off;
1257 if (!(
s->s_off >=
s->s_chunk_pos &&
1259 result =
getat(
s,
s->s_off,
s->s_chunk,
sizeof s->s_chunk);
1261 s->s_chunk_pos =
s->s_off;
1264 memcpy(
buf, &
s->s_chunk[
s->s_off -
s->s_chunk_pos], nob);
1280 if (!
s->s_gen_found) {
1281 s->s_gen_found =
true;
1283 printf(
"\nBeck will use latest generation id found in btree\n");
1307 M0_PRE(len >=
sizeof *act);
1319 int idx =
node->bt_backlink.bli_type;
1328 if (!
s->s_gen_found) {
1329 s->s_gen_found =
true;
1330 s->s_gen =
node->bt_backlink.bli_gen;
1331 printf(
"\nBeck will use latest generation id found in bnode\n");
1342 c->c_kv +=
node->bt_num_active_key;
1343 if (
node->bt_isleaf) {
1346 c->c_fanout +=
node->bt_num_active_key + 1;
1347 c->c_maxlevel =
max64(
c->c_maxlevel,
node->bt_level);
1354 int idx =
node->bt_backlink.bli_type;
1363 const struct m0_fid *emap_fid,
1389 struct m0_fid dom_id = {};
1420 uint64_t inv_emap_off;
1422 for (
i = 0;
i <
node->bt_num_active_key;
i++) {
1431 if (
s->s_print_invalid_oids) {
1433 inv_emap_off =
node->bt_kv_arr[
i].btree_key -
1437 " segment offset %" PRIx64 " for GOB " 1455 node->bt_backlink.bli_type, 1);
1477 return rc == -ESRCH ? -ENOENT :
rc;
1494 return M0_RC(-EINVAL);
1559 bo_u.u_emap.e_rc) : 0;
1587 (in_ext.
e_end -
seg->ee_ext.e_start);
1633 M0_LOG(
M0_INFO,
"Segment header format: %hu:%hu:%u vs. %hu:%hu:%u.",
1634 tag.ot_version,
tag.ot_version,
tag.ot_footer_offset,
1635 r->r_tag.ot_version,
r->r_tag.ot_version,
1636 r->r_tag.ot_footer_offset);
1650 printf(
"\nFound another segment header generation\n");
1668 if (
g[
i].g_gen ==
gen ||
g[
i].g_count == 0) {
1677 uint64_t partitions_nr)
1710 off_t
offset = snapshot_size;
1711 off_t max_offset = 0;
1720 if (ofptr ==
NULL) {
1732 if (
pinfo->pi_act_added[
p] == 0)
1737 if (
pinfo->pi_act_done[
p] == 0) {
1752 if (
pinfo->pi_act_added[
p] >
1757 if (max_offset < winfo->woi_offset[
p])
1766 if(
offset == snapshot_size) {
1770 printf(
"partitions idle,scanner offset=%li\n",
1806 if (ofptr ==
NULL) {
1807 printf(
"Cannot open seek_offset file :%s\n",
offset_file);
1829 uint64_t worker_index,
1851 uint64_t worker_index,
1878 bool put_successful;
1892 if (!put_successful)
1952 char *str_cfg_init =
"directio=true";
1954 uint64_t ad_dom_count;
1957 str_cfg_init =
"directio=false";
1972 ad_dom_count = ad_domains_tlist_length(&module->
sam_domains);
1979 if (adom_info ==
NULL) {
2026 return M0_RC(result);
2037 .rhia_dtm = (
void *)1,
2038 .rhia_mdstore = (
void *)1,
2068 printf(
"\nDestination segment header generation\n");
2094 m0_get()->i_mds_cdom_key);
2106 return M0_RC(result);
2119 warn(
"Failed m0_stob_destroy for AD domain rc=%d",
rc);
2147 printf(
"builder: actions: %9" PRId64 "\n", b->
b_act);
2178 tb_cfg->tbc_workers_nr = 64;
2179 tb_cfg->tbc_work_items_per_tx_max = 100;
2183 const char *str_key,
2184 const char *str_value)
2191 bool value_overridden =
true;
2193 if (
m0_streq(str_key,
"tgc_size_max") ||
2194 m0_streq(str_key,
"bec_tx_size_max")) {
2199 s2 = strchr(s1,
',');
2210 (value2_64 != ULLONG_MAX),
2211 "Invalid value %s for variable %s in yaml file.",
2212 str_value, str_key);
2214 if (
m0_streq(str_key,
"tgc_size_max")) {
2221 }
else if (
m0_streq(str_key,
"bpdc_seg_io_nr") ||
2222 m0_streq(str_key,
"ldsc_items_max") ||
2223 m0_streq(str_key,
"ldsc_items_threshold")) {
2230 "Invalid value %s for variable %s in yaml file.",
2231 str_value, str_key);
2233 if (
m0_streq(str_key,
"bpdc_seg_io_nr")) {
2235 }
else if (
m0_streq(str_key,
"ldsc_items_max")) {
2237 }
else if (
m0_streq(str_key,
"ldsc_items_threshold")) {
2247 "Invalid value %s for variable %s in yaml file.",
2248 str_value, str_key);
2250 if (
m0_streq(str_key,
"bec_tx_active_max"))
2252 else if (
m0_streq(str_key,
"bec_group_nr"))
2254 else if (
m0_streq(str_key,
"tgc_tx_nr_max"))
2256 else if (
m0_streq(str_key,
"tgc_payload_max"))
2259 else if (
m0_streq(str_key,
"bec_tx_payload_max"))
2261 else if (
m0_streq(str_key,
"bec_group_freeze_timeout_min"))
2263 else if (
m0_streq(str_key,
"bec_group_freeze_timeout_max"))
2265 else if (
m0_streq(str_key,
"bec_group_freeze_timeout_limit"))
2268 else if (
m0_streq(str_key,
"lc_full_threshold"))
2270 else if (
m0_streq(str_key,
"ldsc_sync_timeout"))
2273 value_overridden =
false;
2276 if (value_overridden) {
2277 printf(
"%s = %s\n", str_key, str_value);
2292 bool is_key =
false;
2293 bool key_received =
false;
2294 bool value_received =
false;
2299 if (!yaml_parser_initialize(&
parser)) {
2300 printf(
"Failed to initialize yaml parser.\n");
2305 yaml_parser_set_input_file(&
parser,
fp);
2307 printf(
"Changed following BE defaults:\n");
2312 switch (
token.type) {
2313 case YAML_KEY_TOKEN:
2316 case YAML_VALUE_TOKEN:
2319 case YAML_SCALAR_TOKEN:
2320 scalar_value = (
char *)
token.data.scalar.value;
2322 strncpy(
key, scalar_value,
sizeof(
key));
2323 key[
sizeof(
key) - 1] =
'\0';
2324 key_received =
true;
2326 strncpy(
value, scalar_value,
2329 value_received =
true;
2332 if (key_received && value_received) {
2334 key_received =
false;
2335 value_received =
false;
2347 printf(
"Failed to parse %s\n",
key);
2351 if (
token.type != YAML_STREAM_END_TOKEN)
2352 yaml_token_delete(&
token);
2354 }
while (
token.type != YAML_STREAM_END_TOKEN);
2356 yaml_token_delete(&
token);
2358 yaml_parser_delete(&
parser);
2371 M0_PRE(len >=
sizeof *act);
2387 if (memcmp(&
tag, &
rt[rtype].r_tag,
sizeof tag) != 0)
2399 (
node->bt_isleaf == (
node->bt_level == 0)) &&
2404 node->bt_kv_arr[
i].btree_key) &&
2406 node->bt_kv_arr[
i].btree_val));
2413 return ergo(
node->bt_num_active_key > 1,
2415 ops->ko_compare(
node->bt_kv_arr[
i+1].btree_key,
2416 node->bt_kv_arr[
i].btree_key)));
2424 (uint64_t)
node->bt_kv_arr[
index].btree_val -
2425 (uint64_t)
node->bt_kv_arr[
index].btree_key;
2431 return s->s_max_reg_size >
key->b_nob +
val->b_nob;
2441 const struct m0_fid *fid1)
2456 return &
c->c_slot[idx];
2491 *((uint64_t *)(kdata)) =
sizeof(
struct m0_fid);
2528 if (len >
s->s_max_reg_size)
2533 *(uint64_t *)kbuf->
b_addr = len;
2556 if (hdr.len >
s->s_max_reg_size)
2561 *(
struct hdr *)vbuf->
b_addr = hdr;
2571 if (*(uint64_t *)(kbuf->
b_addr) != sizeof (
struct m0_fid))
2596 node->bt_num_active_key);
2599 for (
i = 0;
i <
node->bt_num_active_key;
i++) {
2601 &kl[
n.bt_num_active_key]) != 0) {
2607 &vl[
n.bt_num_active_key]) == 0) {
2610 &vl[
n.bt_num_active_key]) &&
2612 n.bt_kv_arr[
n.bt_num_active_key].btree_key =
2613 kl[
n.bt_num_active_key].
b_addr;
2614 n.bt_num_active_key++;
2626 for (
i = 0;
i <
n.bt_num_active_key;
i++) {
2634 for (
i = 0;
i <
n.bt_num_active_key;
i++) {
2664 struct m0_fid *cas_ctg_fid,
2677 &(
struct m0_ext) { .e_start = 0,
2678 .e_end = IMASK_INF },
2735 if (
rc == -ENOENT) {
2737 }
else if (
rc != 0) {
2782 return _0C((
q->q_nr == 0) == (
q->q_head ==
NULL &&
2783 q->q_tail ==
NULL)) &&
2784 _0C((
q->q_nr == 1) == (
q->q_head ==
q->q_tail &&
2785 q->q_head !=
NULL)) &&
2786 _0C((
q->q_nr > 1) == (
q->q_head !=
q->q_tail &&
2787 q->q_head !=
NULL &&
2788 q->q_tail !=
NULL)) &&
2789 _0C(
q->q_nr <=
q->q_max);
2796 result = pthread_mutex_init(&
q->q_lock,
NULL);
2798 result = pthread_cond_init(&
q->q_cond,
NULL);
2808 result = pthread_cond_destroy(&
q->q_cond);
2810 result = pthread_mutex_destroy(&
q->q_lock);
2820 pthread_mutex_lock(&
q->q_lock);
2822 while (
q->q_nr ==
q->q_max)
2823 pthread_cond_wait(&
q->q_cond, &
q->q_lock);
2825 if (
q->q_head !=
NULL)
2826 q->q_head->a_prev = act;
2828 if (
q->q_tail ==
NULL) {
2830 pthread_cond_broadcast(&
q->q_cond);
2834 pthread_mutex_unlock(&
q->q_lock);
2844 if (
q->q_tail ==
NULL)
2847 q->q_tail->a_next =
NULL;
2850 if (
q->q_nr ==
q->q_max)
2851 pthread_cond_broadcast(&
q->q_cond);
2861 pthread_mutex_lock(&
q->q_lock);
2863 while (
q->q_nr == 0)
2864 pthread_cond_wait(&
q->q_cond, &
q->q_lock);
2867 pthread_mutex_unlock(&
q->q_lock);
2875 pthread_mutex_lock(&
q->q_lock);
2879 pthread_mutex_unlock(&
q->q_lock);
2887 pthread_mutex_lock(&
q->q_lock);
2889 ret = (
q->q_nr == 0) ?
true :
false;
2890 pthread_mutex_unlock(&
q->q_lock);
2933 key->b_addr +
sizeof nskey,
2962 uint64_t inv_cob_off;
2966 for (
i = 0;
i <
node->bt_num_active_key;
i++) {
2991 if (
s->s_print_invalid_oids) {
2993 inv_cob_off =
node->bt_kv_arr[
i].btree_val -
2996 "segment offset %" PRIx64 " for GOB " 3148 printf(
"\tQueue...");
3152 LAMBDA(
void, (
void *nonce) {
3156 for (
n = 0;
n < 2 *
NR; ++
n) {
3162 }),
NULL,
"qp-%d",
i);
3164 LAMBDA(
void, (
void *nonce) {
3175 }),
NULL,
"qg-%d",
i);
3177 LAMBDA(
void, (
void *nonce) {
3189 }),
NULL,
"qt-%d",
i);
3209 #undef M0_TRACE_SUBSYSTEM m0_bcount_t tgc_payload_max
struct m0_cob_nsrec co_nsrec
#define M0_GETOPTS(progname, argc, argv,...)
static void cob_fini(struct action *act)
static struct m0_fid gob_fid
static const struct action_ops done_ops
M0_INTERNAL void m0_reqh_be_fini(struct m0_reqh *reqh)
static struct m0_addb2_philter p
M0_INTERNAL void m0_ctg_ctidx_insert_credits(struct m0_cas_id *cid, struct m0_be_tx_credit *accum)
struct m0_be_domain * bs_domain
static bool btree_kv_is_valid(struct m0_be_bnode *node, int index, struct m0_buf *key)
m0_time_t bec_group_freeze_timeout_max
static struct cache_slot * ctg_getslot_insertcred(struct ctg_action *ca, struct builder *b, struct m0_fid *cas_ctg_fid, struct m0_be_tx_credit *accum)
#define M0_ALLOC_ARR(arr, nr)
static void nv_scan_offset_fini(void)
static int ctg_k_get(struct scanner *s, const void *addr, struct m0_buf *kbuf)
char bh_be_version[M0_BE_SEG_HDR_VERSION_LEN_MAX+1]
M0_INTERNAL void m0_be_tx_bulk_run(struct m0_be_tx_bulk *tb, struct m0_be_op *op)
M0_INTERNAL int m0_be_tx_bulk_init(struct m0_be_tx_bulk *tb, struct m0_be_tx_bulk_cfg *tb_cfg)
struct m0_format_footer er_footer
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
M0_INTERNAL int m0_be_ut_backend_init_cfg(struct m0_be_ut_backend *ut_be, const struct m0_be_domain_cfg *cfg, bool mkfs)
const struct recops * r_ops
int(* ro_ver)(struct scanner *s, struct rectype *r, char *buf)
static struct m0_cas_ctg * ctg_create_meta(struct ctg_action *ca, struct m0_be_tx *tx)
struct m0_be_tx_credit b_cred
#define M0_FLAGARG(ch, desc, ptr)
static struct m0_stob_ad_domain * emap_dom_find(const struct action *act, const struct m0_fid *emap_fid, int *lockid)
static struct m0_semaphore q
M0_INTERNAL void m0_be_tx_bulk_end(struct m0_be_tx_bulk *tb)
static void generation_id_print(uint64_t gen)
static struct action * qget(struct queue *q)
M0_INTERNAL int m0_stob_locate(struct m0_stob *stob)
struct cache_slot c_slot[CACHE_SIZE]
const struct m0_xcode_enum_val * xe_val
int m0_thread_join(struct m0_thread *q)
#define M0_REQH_INIT(reqh,...)
static int builder_init(struct builder *b)
static void builder_do(struct m0_be_tx_bulk *tb, struct m0_be_tx *tx, struct m0_be_op *op, void *datum, void *user, uint64_t worker_index, uint64_t partition)
M0_INTERNAL void m0_be_btree_lookup(struct m0_be_btree *tree, struct m0_be_op *op, const struct m0_buf *key, struct m0_buf *value)
static void stats_print(void)
uint64_t pi_act_added[AO_NR]
static int ctg_btree_fid_get(struct m0_buf *kbuf, struct m0_fid *fid)
static uint64_t tag(uint8_t code, uint64_t id)
M0_INTERNAL void m0_ctg_store_fini(void)
struct m0_stob_ad_module i_stob_ad_module
static void seg_get(FILE *fp, struct m0_be_seg *out)
int(* ro_proc)(struct scanner *s, struct rectype *r, char *buf)
#define M0_LOG(level,...)
static struct action * qpeek(struct queue *q)
uint64_t woi_act_done[AO_NR]
struct m0_format_footer cs_footer
bool s_print_invalid_oids
#define M0_FID_INIT(container, key)
static void genadd(uint64_t gen)
static struct net_test_cmd_node * node
static bool btree_node_post_is_valid(const struct m0_be_bnode *node, const struct m0_be_btree_kv_ops *ops)
static int ctg_v_get(struct scanner *s, const void *addr, struct m0_buf *vbuf)
static int deref(struct scanner *s, const void *addr, void *buf, size_t nob)
static int emap_prep(struct action *act, struct m0_be_tx_credit *cred)
uint64_t m0_time_nanoseconds(const m0_time_t time)
static void scanner_thread(struct scanner *s)
static int scanner_cache_init(struct scanner *s)
static struct m0_uint128 prefix
#define M0_BE_OP_SYNC(op_obj, action)
M0_INTERNAL void m0_ios_cdom_get(struct m0_reqh *reqh, struct m0_cob_domain **out)
M0_INTERNAL void m0_fid_convert_cob2adstob(const struct m0_fid *cob_fid, struct m0_stob_id *stob_id)
struct m0_format_footer cb_footer
char * but_stob_domain_location
static bool disable_directio
static uint64_t magic(const struct m0_tl_descr *d, const void *obj)
M0_INTERNAL void m0_be_emap_obj_insert(struct m0_be_emap *map, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_uint128 *prefix, uint64_t val)
M0_INTERNAL const struct m0_fid m0_cas_meta_fid
M0_TL_DECLARE(ad_domains, M0_EXTERN, struct ad_domain_map)
const struct m0_fid_type m0_cob_fid_type
struct m0_dix_layout ci_layout
int const char const void * value
const struct m0_stob_type m0_stob_ad_type
M0_INTERNAL struct m0_be_seg * m0_be_domain_seg0_get(struct m0_be_domain *dom)
static const struct action_ops ctg_ops
struct m0_cob_domain * b_ios_cdom
M0_INTERNAL uint8_t m0_fid_tget(const struct m0_fid *fid)
M0_INTERNAL void m0_be_emap_close(struct m0_be_emap_cursor *it)
static int emap_entry_lookup(struct m0_stob_ad_domain *adom, struct m0_uint128 prefix, m0_bindex_t offset, struct m0_be_emap_cursor *it)
static struct m0_be_emap_cursor it
struct m0_cob_domain * b_mds_cdom
const struct m0_ad_balloc_ops * ab_ops
uint64_t woi_act_added[AO_NR]
struct m0_format_footer cd_footer
struct m0_be_seg * b_seg0
static const struct action_ops cob_ops
static bool fid_without_type_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
#define M0_THREAD_INIT(thread, TYPE, init, func, arg, namefmt,...)
M0_INTERNAL void m0_be_ut_backend_seg_add2(struct m0_be_ut_backend *ut_be, m0_bcount_t size, bool preallocate, const char *stob_create_cfg, struct m0_be_seg **out)
M0_INTERNAL struct m0 * m0_get(void)
static int cob_proc(struct scanner *s, struct btype *b, struct m0_be_bnode *node, off_t node_offset)
static const struct recops btreeops
int m0_init(struct m0 *instance)
struct m0_be_emap_seg ec_seg
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
struct m0_thread s_thread
static struct cache_slot * cache_lookup(struct cache *c, struct m0_fid *fid)
static int ctg_prep(struct action *act, struct m0_be_tx_credit *accum)
static int getat(struct scanner *s, off_t off, void *buf, size_t nob)
struct m0_be_tx_credit bec_tx_size_max
static int seghdr_check(struct scanner *s, struct rectype *r, char *buf)
M0_INTERNAL void m0_reqh_fini(struct m0_reqh *reqh)
struct m0_be_domain * b_dom
M0_INTERNAL bool m0_fid_is_set(const struct m0_fid *fid)
M0_INTERNAL void m0_stob_ad_init_cfg_make(char **str, struct m0_be_domain *dom)
struct m0_be_btree_backlink bb_backlink
uint64_t bec_tx_active_max
struct m0_format_footer cc_foot
M0_INTERNAL void m0_cob_init(struct m0_cob_domain *dom, struct m0_cob *cob)
static void emap_to_gob_convert(const struct m0_uint128 *emap_prefix, struct m0_fid *out)
bool m0_xcode_enum_is_valid(const struct m0_xcode_enum *en, uint64_t val)
static void test_queue(void)
struct m0_mutex b_emaplock[AO_NR - AO_EMAP_FIRST]
M0_INTERNAL void m0_cob_tx_credit(struct m0_cob_domain *dom, enum m0_cob_op optype, struct m0_be_tx_credit *accum)
uint64_t tbc_partitions_nr
static int btree(struct scanner *s, struct rectype *r, char *buf)
#define M0_BE_TX_CREDIT(nr, size)
struct cache_slot * cta_slot
struct m0_stob_ad_domain * adm_dom
static int ctg_pver_fid_get(struct m0_fid *fid)
struct m0_ad_balloc * sad_ballroom
m0_time_t bec_group_freeze_timeout_limit
struct m0_reqh * bec_reqh
struct m0_format_footer e_footer
struct m0_be_ut_backend b_backend
#define M0_STRINGARG(ch, desc, func)
void m0_build_info_print(void)
static bool isqempty(struct queue *q)
static void ctg_fini(struct action *act)
void m0_be_ut_backend_cfg_default(struct m0_be_domain_cfg *cfg)
static int64_t max64(int64_t a, int64_t b)
static bool btree_node_pre_is_valid(const struct m0_be_bnode *node, struct scanner *s)
static void noop_act(struct action *act, struct m0_be_tx *tx)
static void builder_thread(struct builder *b)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL void m0_be_emap_paste(struct m0_be_emap_cursor *it, struct m0_be_tx *tx, struct m0_ext *ext, uint64_t val, void(*del)(struct m0_be_emap_seg *), void(*cut_left)(struct m0_be_emap_seg *, struct m0_ext *, uint64_t), void(*cut_right)(struct m0_be_emap_seg *, struct m0_ext *, uint64_t))
const struct m0_build_info * m0_build_info_get(void)
#define M0_BE_OP_SYNC_RET(op_obj, action, member)
struct m0_be_emap_rec emap_val_data
M0_INTERNAL void m0_ctg_try_init(struct m0_cas_ctg *ctg)
void(* o_fini)(struct action *act)
struct be_btree_key_val bt_kv_arr[KV_NR]
M0_INTERNAL int m0_be_tx_bulk_status(struct m0_be_tx_bulk *tb)
M0_INTERNAL void m0_be_btree_insert(struct m0_be_btree *tree, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_buf *key, const struct m0_buf *val)
M0_INTERNAL const struct m0_be_btree_kv_ops * m0_ctg_btree_ops(void)
#define M0_FID_TINIT(type, container, key)
#define M0_AMB(obj, ptr, field)
static void sig_handler(int num)
#define M0_FORMATARG(ch, desc, fmt, ptr)
M0_INTERNAL struct m0_cas_ctg * m0_ctg_meta(void)
static const struct action_ops emap_ops
M0_INTERNAL int m0_cob_name_add(struct m0_cob *cob, struct m0_cob_nskey *nskey, struct m0_cob_nsrec *nsrec, struct m0_be_tx *tx)
M0_INTERNAL void m0_be_btree_insert_credit(const struct m0_be_btree *tree, m0_bcount_t nr, m0_bcount_t ksize, m0_bcount_t vsize, struct m0_be_tx_credit *accum)
uint64_t oi_partitions_nr
static struct m0_stob * stob
static struct m0_cob * cob
static int ctg_proc(struct scanner *s, struct btype *b, struct m0_be_bnode *node, off_t node_offset)
struct m0_be_tx_credit tgc_size_max
struct m0_format_footer bb_footer
struct m0_bitstring cnk_name
static void qput(struct queue *q, struct action *act)
struct scanner_off_info noi_scanoff
struct m0_be_emap sad_adata
static void emap_fini(struct action *act)
M0_INTERNAL void m0_ext_init(struct m0_ext *ext)
struct m0_format_footer psu_footer
static void scanner_fini(struct scanner *s)
static struct m0_addb2_callback c
struct m0_uint128 ek_prefix
void m0_node_uuid_string_set(const char *uuid)
m0_bcount_t s_max_reg_size
uint64_t m0_strtou64(const char *str, char **endptr, int base)
#define RLOG(level, prefix, s, r, tag)
static void be_cfg_default_init(struct m0_be_domain_cfg *dom_cfg, struct m0_be_tx_bulk_cfg *tb_cfg)
static struct cache_slot * cache_insert(struct cache *c, const struct m0_fid *fid)
M0_INTERNAL int m0_ctg_store_init(struct m0_be_domain *dom)
void m0_thread_fini(struct m0_thread *q)
uint32_t ldsc_items_threshold
static struct m0_stob_domain * dom
static long long max(long long a, long long b)
struct m0_mutex b_coblock
static const struct recops bnodeops
M0_INTERNAL void m0_stob_id_make(uint64_t container, uint64_t key, const struct m0_fid *dom_id, struct m0_stob_id *stob_id)
M0_INTERNAL int m0_dix_ldesc_init(struct m0_dix_ldesc *ld, struct m0_ext *range, m0_bcount_t range_nr, enum m0_dix_hash_fnc_type htype, struct m0_fid *pver)
struct part_info noi_pinfo
static struct rectype rt[]
static struct m0_fid cob_fid
struct m0_stob_ad_domain ** b_ad_domain
struct m0_be_btree * cs_tree
M0_INTERNAL int m0_ctg__meta_insert(struct m0_be_btree *meta, const struct m0_fid *fid, struct m0_cas_ctg *ctg, struct m0_be_tx *tx)
struct m0_mutex b_ctglock
M0_INTERNAL struct m0_stob_ad_domain * stob_ad_domain2ad(const struct m0_stob_domain *dom)
unsigned long tgc_tx_nr_max
static int nv_scan_offset_init(uint64_t workers_nr, uint64_t partitions_nr)
M0_INTERNAL int m0_buf_alloc(struct m0_buf *buf, size_t size)
void * m0_alloc(size_t size)
struct m0_be_op::@39::@40 u_emap
static char iobuf[4 *1024 *1024]
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
static void be_cfg_update(struct m0_be_domain_cfg *cfg, const char *str_key, const char *str_value)
static const char * recname(const struct rectype *rt)
int(* ro_check)(struct scanner *s, struct rectype *r, char *buf)
M0_INTERNAL void m0_ctg_create_credit(struct m0_be_tx_credit *accum)
static int cob_prep(struct action *act, struct m0_be_tx_credit *accum)
const char * stob_location
struct m0_stob_id sad_bstore_id
M0_INTERNAL void m0_be_emap_lookup(struct m0_be_emap *map, const struct m0_uint128 *prefix, m0_bindex_t offset, struct m0_be_emap_cursor *it)
static void token(struct ff2c_context *ctx, struct ff2c_term *term, struct ff2c_token *tok)
struct m0_sm_group * m0_be_ut_backend_sm_group_lookup(struct m0_be_ut_backend *ut_be)
M0_INTERNAL void m0_be_op_done(struct m0_be_op *op)
M0_INTERNAL const struct m0_fid m0_cas_dead_index_fid
static m0_bindex_t offset
static struct builder beck_builder
struct m0_be_btree cc_tree
static void qinit(struct queue *q, uint64_t maxnr)
struct m0_format_footer bl_format_footer
M0_INTERNAL void m0_buf_free(struct m0_buf *buf)
M0_INTERNAL int m0_ctg_meta_find_ctg(struct m0_cas_ctg *meta, const struct m0_fid *ctg_fid, struct m0_cas_ctg **ctg)
static void ad_dom_fini(struct builder *b)
int m0_ctg_create(struct m0_be_seg *seg, struct m0_be_tx *tx, struct m0_cas_ctg **out, const struct m0_fid *cas_fid)
static void qfini(struct queue *q)
union m0_dix_layout::@145 u
uint64_t m0_time_seconds(const m0_time_t time)
struct m0_be_domain but_dom
void(* o_act)(struct action *act, struct m0_be_tx *tx)
M0_BASSERT(ARRAY_SIZE(rt)==M0_FORMAT_TYPE_NR+1)
int m0_cob_domain_init(struct m0_cob_domain *dom, struct m0_be_seg *seg)
M0_INTERNAL bool m0_be_seg_contains(const struct m0_be_seg *seg, const void *addr)
M0_INTERNAL struct m0_stob_domain * m0_stob_domain_find_by_stob_id(const struct m0_stob_id *stob_id)
static struct nv_offset_info nv_off_info
M0_INTERNAL void m0_be_engine_tx_size_max(struct m0_be_engine *en, struct m0_be_tx_credit *cred, m0_bcount_t *payload_size)
uint32_t m0_strtou32(const char *str, char **endptr, int base)
struct m0_format_footer sad_footer
static void * builder_action(struct builder *b, size_t len, enum action_opcode opc, const struct action_ops *ops)
struct m0_be_btree em_mapping
M0_INTERNAL void m0_stob_domain_fini(struct m0_stob_domain *dom)
struct m0_be_emap_key emap_key_data
struct builder * a_builder
M0_INTERNAL int m0_stob_create(struct m0_stob *stob, struct m0_dtx *dtx, const char *str_cfg)
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
#define m0_forall(var, nr,...)
static int seghdr_ver(struct scanner *s, struct rectype *r, char *buf)
const char * b_be_config_file
struct m0_be_domain_cfg but_dom_cfg
static const char * bname(const struct btype *bt)
struct m0_be_pd_cfg bc_pd_cfg
struct m0_be_emap sad_adata
M0_INTERNAL int m0_stob_destroy(struct m0_stob *stob, struct m0_dtx *dtx)
struct m0_be_log_discard_cfg bc_log_discard_cfg
static void cob_act(struct action *act, struct m0_be_tx *tx)
M0_INTERNAL bool m0_be_tx_bulk_put(struct m0_be_tx_bulk *tb, struct m0_be_op *op, struct m0_be_tx_credit *credit, m0_bcount_t payload_credit, uint64_t partition, void *user)
static int emap_proc(struct scanner *s, struct btype *b, struct m0_be_bnode *node, off_t node_offset)
M0_INTERNAL enum m0_stob_state m0_stob_state_get(struct m0_stob *stob)
M0_INTERNAL void m0_ctg_state_inc_update(struct m0_be_tx *tx, uint64_t size)
M0_INTERNAL void m0_be_op_active(struct m0_be_op *op)
struct m0_format_footer bt_footer
static int parse(struct scanner *s)
M0_INTERNAL void m0_be_tx_bulk_fini(struct m0_be_tx_bulk *tb)
#define M0_BUF_INIT_PTR(p)
M0_INTERNAL int m0_stob_domain_init(const char *location, const char *str_cfg_init, struct m0_stob_domain **out)
M0_INTERNAL void m0_fid_tchange(struct m0_fid *fid, uint8_t tid)
static int bnode_check(struct scanner *s, struct rectype *r, char *buf)
static const char * offset_file
struct m0_format_footer sa0_footer
static void btree_bad_kv_count_update(uint64_t type, int count)
static struct m0_be_seg s_seg
static bool btree_kv_post_is_valid(struct scanner *s, struct m0_buf *key, struct m0_buf *val)
#define M0_ALLOC_PTR(ptr)
static void builder_fini(struct builder *b)
m0_time_t bec_group_freeze_timeout_min
struct m0_stob_domain * stob_dom
struct m0_format_tag r_tag
M0_TL_DESCR_DECLARE(ad_domains, M0_EXTERN)
m0_time_t m0_time_sub(const m0_time_t t1, const m0_time_t t2)
struct ad_dom_info ** b_ad_info
M0_INTERNAL int m0_ctg_ctidx_insert_sync(const struct m0_cas_id *cid, struct m0_be_tx *tx)
struct m0_format_footer bgd_footer
M0_INTERNAL void m0_be_op_fini(struct m0_be_op *op)
static int generation_id_verify(struct scanner *s, uint64_t gen)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
off_t pi_1st_bnode_offset[AO_NR]
M0_INTERNAL int m0_cc_stob_cr_credit(struct m0_stob_id *sid, struct m0_be_tx_credit *accum)
void m0_be_ut_backend_fini(struct m0_be_ut_backend *ut_be)
#define IS_IN_ARRAY(idx, array)
static struct m0 instance
struct m0_be_log_cfg bc_log
#define FLOG(level, rc, s)
uint8_t coa_valdata[sizeof(struct m0_cob_nsrec)]
static const char * yaml_file
M0_INTERNAL struct m0_cas_ctg * m0_ctg_ctidx(void)
M0_INTERNAL int m0_stob_find(const struct m0_stob_id *id, struct m0_stob **out)
static struct m0_be_seg * seg
static struct scanner beck_scanner
static int emap_kv_get(struct scanner *s, const struct be_btree_key_val *kv, struct m0_buf *key_buf, struct m0_buf *val_buf)
#define M0_UINT128(hi, lo)
struct m0_mutex oi_part_lock[AO_NR]
M0_INTERNAL void m0_fid_convert_cob2gob(const struct m0_fid *cob_fid, struct m0_fid *gob_fid)
#define M0_ASSERT_INFO(cond, fmt,...)
struct m0_be_tx_group_cfg bec_group_cfg
static int recdo(struct scanner *s, const struct m0_format_tag *tag, struct rectype *rt)
M0_INTERNAL struct m0_be_seg * m0_be_domain_seg_first(const struct m0_be_domain *dom)
#define _T(name, str, field, ops)
int main(int argc, char **argv)
struct m0_format_footer bh_footer
static void generation_id_get(FILE *fp, uint64_t *gen_id)
int(* b_proc)(struct scanner *s, struct btype *b, struct m0_be_bnode *node, off_t node_offset)
M0_INTERNAL size_t m0_cob_nskey_size(const struct m0_cob_nskey *cnk)
static int format_header_verify(const struct m0_format_header *h, uint16_t rtype)
struct m0_format_footer ek_footer
M0_INTERNAL const struct m0_fid m0_cas_ctidx_fid
enum m0_be_btree_type b_type
static int btree_check(struct scanner *s, struct rectype *r, char *buf)
M0_INTERNAL void m0_be_emap_credit(struct m0_be_emap *map, enum m0_be_emap_optype optype, m0_bcount_t nr, struct m0_be_tx_credit *accum)
struct m0_be_engine bd_engine
struct worker_off_info noi_offset[MAX_WORKERS_NR]
static void builder_done(struct m0_be_tx_bulk *tb, void *datum, void *user, uint64_t worker_index, uint64_t partition)
m0_bcount_t lc_full_threshold
static bool qinvariant(const struct queue *q)
static void * scanner_action(size_t len, enum action_opcode opc, const struct action_ops *ops)
static struct m0_be_tx_bulk_cfg default_tb_cfg
static void noop_fini(struct action *act)
uint64_t pi_act_done[AO_NR]
const struct action_ops * a_ops
static int scan(struct scanner *s)
M0_INTERNAL bool m0_fid_validate_cob(const struct m0_fid *cob_fid)
m0_time_t ldsc_sync_timeout
static int noop_prep(struct action *act, struct m0_be_tx_credit *cred)
static struct gen g[MAX_GEN]
#define m0_tl_for(name, head, obj)
M0_INTERNAL void m0_be_op_init(struct m0_be_op *op)
static void nv_scan_offset_update(void)
static int ad_dom_init(struct builder *b)
M0_INTERNAL int m0_reqh_be_init(struct m0_reqh *reqh, struct m0_be_seg *seg)
void(* bo_alloc_credit)(const struct m0_ad_balloc *ballroom, int nr, struct m0_be_tx_credit *accum)
static struct m0_addb2_source * s
struct m0_thread b_thread
static int scanner_init(struct scanner *s)
struct m0_stob_domain * b_ad_dom
#define M0_BUF_INIT(size, data)
static bool seg_hdr_get(FILE *fp, struct m0_be_seg_hdr *out)
static void builder_work_put(struct m0_be_tx_bulk *tb, struct builder *b)
struct m0_be_engine_cfg bc_engine
struct m0_be_queue_cfg tbc_q_cfg
struct m0_be_seg_geom bh_items[M0_BE_SEG_HDR_GEOM_ITMES_MAX]
static void ctg_act(struct action *act, struct m0_be_tx *tx)
struct m0_format_header bh_header
M0_INTERNAL bool m0_be_op_is_done(struct m0_be_op *op)
static struct offset_info off_info
static int cob_kv_get(struct scanner *s, const struct be_btree_key_val *kv, struct m0_buf *key, struct m0_buf *val)
static uint64_t m0_align(uint64_t val, uint64_t alignment)
static bool mmap_be_segment
struct m0_format_footer em_footer
#define M0_BE_OP_SYNC_RET_WITH(op, action, member)
struct m0_format_footer cnr_footer
static int bnode(struct scanner *s, struct rectype *r, char *buf)
void m0_be_ut_backend_thread_exit(struct m0_be_ut_backend *ut_be)
static const struct recops seghdrops
unsigned char s_chunk[4 *1024 *1024]
static struct action * qtry(struct queue *q)
struct m0_fid_type st_fidt
static int seghdr(struct scanner *s, struct rectype *r, char *buf)
static struct m0_stob_domain * sdom
static off_t nv_scan_offset_get(off_t snapshot_size)
static int be_cfg_from_yaml_update(const char *yaml_file, struct m0_be_domain_cfg *cfg)
M0_INTERNAL void m0_fid_tassume(struct m0_fid *fid, const struct m0_fid_type *ft)
struct m0_be_btree cd_namespace
m0_bcount_t bec_tx_payload_max
static void emap_act(struct action *act, struct m0_be_tx *tx)
int(* o_prep)(struct action *act, struct m0_be_tx_credit *cred)