23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_BE 84 unsigned char last_byte;
89 .ot_version = M0_BE_SEG_HDR_FORMAT_VERSION,
90 .ot_type = M0_FORMAT_TYPE_BE_SEG_HDR,
91 .ot_footer_offset = offsetof(struct m0_be_seg_hdr, bh_footer)
94 for (
i = 0;
i < len; ++
i) {
98 stob,
g->sg_size,
g->sg_addr,
g->sg_offset,
g->sg_id);
136 g->sg_offset +
g->sg_size - 1,
140 "can't write segment's last byte");
169 for (
i = 0;
i < len; ++
i) {
176 for (j = 0; j < len; ++j) {
177 if (&geom[j] == &geom[
i])
212 return M0_RC(-ENOMEM);
215 for (
i = 0;
i < len; ++
i)
307 if (
flag == MADV_DONTDUMP)
328 const char *runtime_be_version;
348 bi_xcode_protocol_be_checksum;
352 " expected '%s', stored on disk '%s'",
365 p = mmap(
g->sg_addr,
g->sg_size, PROT_READ | PROT_WRITE,
366 MAP_FIXED | MAP_PRIVATE | MAP_NORESERVE,
fd,
g->sg_offset);
367 if (
p !=
g->sg_addr) {
387 munmap(
g->sg_addr,
g->sg_size);
471 #ifdef USE_TIME_NOW_AS_GEN_IDX 474 M0_CASSERT(
sizeof now ==
sizeof(
unsigned long));
479 M0_CASSERT(
sizeof global_gen_idx ==
sizeof(
unsigned long));
491 #undef M0_TRACE_SUBSYSTEM
M0_INTERNAL int m0_be_seg__write(struct m0_be_reg *reg, void *src)
static void ptr(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
static struct m0_addb2_philter p
struct m0_be_domain * bs_domain
char bh_be_version[M0_BE_SEG_HDR_VERSION_LEN_MAX+1]
M0_INTERNAL void m0_be_seg_fini(struct m0_be_seg *seg)
M0_INTERNAL m0_bindex_t m0_be_seg_offset(const struct m0_be_seg *seg, const void *addr)
M0_INTERNAL int m0_be_seg_create_multiple(struct m0_stob *stob, const struct m0_be_seg_geom *geom)
struct m0_be_allocator bs_allocator
#define M0_LOG(level,...)
M0_INTERNAL int m0_be_seg_create(struct m0_be_seg *seg, m0_bcount_t size, void *addr)
M0_INTERNAL bool m0_be_seg_contains_stob(struct m0_be_seg *seg, const struct m0_stob_id *stob_id)
static int be_seg_hdr_size(void)
M0_INTERNAL int m0_be_reg__write(struct m0_be_reg *reg)
M0_INTERNAL const struct m0_fid * m0_stob_fid_get(struct m0_stob *stob)
M0_INTERNAL int m0_be_reg__read(struct m0_be_reg *reg)
M0_INTERNAL unsigned long m0_be_reg_gen_idx(const struct m0_be_reg *reg)
#define M0_EXT(start, end)
M0_INTERNAL int m0_be_seg_open(struct m0_be_seg *seg)
bool m0_be_reg__invariant(const struct m0_be_reg *reg)
M0_INTERNAL m0_bcount_t m0_be_seg_reserved(const struct m0_be_seg *seg)
#define M0_ERR_INFO(rc, fmt,...)
return M0_ERR(-EOPNOTSUPP)
const struct m0_build_info * m0_build_info_get(void)
M0_INTERNAL int m0_dont_dump(void *p, size_t size)
M0_INTERNAL const struct m0_stob_id * m0_stob_id_get(struct m0_stob *stob)
static struct m0_stob * stob
M0_INTERNAL int m0_be_seg__read(struct m0_be_reg *reg, void *dst)
M0_INTERNAL void m0_be_seg_close(struct m0_be_seg *seg)
static bool m0_is_aligned(uint64_t val, uint64_t alignment)
M0_INTERNAL int m0_be_io_single(struct m0_stob *stob, enum m0_stob_io_opcode opcode, void *ptr_user, m0_bindex_t offset_stob, m0_bcount_t size)
m0_time_t m0_time_now(void)
static struct m0_stob_domain * dom
M0_INTERNAL struct m0_be_allocator * m0_be_seg_allocator(struct m0_be_seg *seg)
void * m0_alloc(size_t size)
static int be_seg_hdr_create(struct m0_stob *stob, struct m0_be_seg_hdr *hdr)
M0_INTERNAL bool m0_be_reg_eq(const struct m0_be_reg *r1, const struct m0_be_reg *r2)
M0_INTERNAL void m0_be_seg_init(struct m0_be_seg *seg, struct m0_stob *stob, struct m0_be_domain *dom, uint64_t seg_id)
static int be_seg_io(struct m0_be_reg *reg, void *ptr, enum m0_stob_io_opcode opcode)
M0_INTERNAL m0_bindex_t m0_be_reg_offset(const struct m0_be_reg *reg)
M0_INTERNAL int m0_stob_fd(struct m0_stob *stob)
M0_INTERNAL int m0_be_seg_destroy(struct m0_be_seg *seg)
static void be_seg_madvise(struct m0_be_seg *seg, m0_bcount_t dump_limit, int flag)
M0_INTERNAL bool m0_stob_id_eq(const struct m0_stob_id *stob_id0, const struct m0_stob_id *stob_id1)
M0_INTERNAL bool m0_ext_are_overlapping(const struct m0_ext *e0, const struct m0_ext *e1)
M0_INTERNAL bool m0_be_seg_geom_eq(const struct m0_be_seg_geom *left, const struct m0_be_seg_geom *right)
struct m0t1fs_filedata * fd
static struct m0_be_seg * seg
static bool be_seg_geom_has_no_overlapps(const struct m0_be_seg_geom *geom, int len)
M0_INTERNAL bool m0_be_seg_contains(const struct m0_be_seg *seg, const void *addr)
M0_INTERNAL bool m0_be_seg__invariant(const struct m0_be_seg *seg)
static int be_seg_geom_len(const struct m0_be_seg_geom *geom)
static struct gen g[MAX_GEN]
struct m0_be_seg * br_seg
M0_INTERNAL void m0_stob_get(struct m0_stob *stob)
struct m0_be_seg_geom bh_items[M0_BE_SEG_HDR_GEOM_ITMES_MAX]
struct m0_pdclust_src_addr src
struct m0_format_header bh_header
M0_INTERNAL void m0_stob_put(struct m0_stob *stob)
static int64_t m0_atomic64_add_return(struct m0_atomic64 *a, int64_t d)
static const struct m0_be_seg_geom * be_seg_geom_find_by_id(const struct m0_be_seg_hdr *hdr, uint64_t id)