32 static int dbg_check_bud_bytes(
struct ubifs_info *
c);
53 else if (lnum > bud->
lnum)
86 else if (lnum > bud->
lnum)
102 static inline long long empty_log_bytes(
const struct ubifs_info *
c)
127 p = &c->
buds.rb_node;
138 rb_link_node(&bud->
rb, parent, p);
154 dbg_log(
"LEB %d:%d, jhead %s, bud_bytes %lld", bud->
lnum,
196 dbg_log(
"not enough log space - %lld, required %d",
213 dbg_log(
"bud bytes %lld (%lld max), require commit",
227 dbg_log(
"bud bytes %lld (%lld max), initiate BG commit",
253 if (bud->
start == 0) {
318 dbg_log(
"preserve %d:%d, jhead %s, bud bytes %d, cmt_bud_bytes %lld",
324 dbg_log(
"remove %d:%d, jhead %s, bud bytes %d, cmt_bud_bytes %lld",
361 err = dbg_check_bud_bytes(c);
387 if (lnum == -1 || offs == c->
leb_size)
390 dbg_log(
"add ref to LEB %d:%d for jhead %s",
465 dbg_log(
"old tail was LEB %d:0, new tail is LEB %d:0",
479 err = dbg_check_bud_bytes(c);
506 err = ubifs_return_leb(c, bud->
lnum);
513 for (lnum = old_ltail_lnum; lnum != c->
ltail_lnum;
514 lnum = ubifs_next_log_lnum(c, lnum)) {
515 dbg_log(
"unmap log LEB %d", lnum);
543 static int done_already(
struct rb_root *done_tree,
int lnum)
553 else if (lnum > dr->
lnum)
565 rb_link_node(&dr->
rb, parent, p);
575 static void destroy_done_tree(
struct rb_root *done_tree)
623 *lnum = ubifs_next_log_lnum(c, *lnum);
626 memcpy(buf + *offs, node, len);
627 *offs +=
ALIGN(len, 8);
646 int lnum,
err,
first = 1, write_lnum, offs = 0;
663 switch (snod->
type) {
668 err = done_already(&done_tree, ref_lnum);
672 err = add_node(c, buf, &write_lnum,
682 err = add_node(c, buf, &write_lnum, &offs,
693 lnum = ubifs_next_log_lnum(c, lnum);
704 destroy_done_tree(&done_tree);
713 lnum = ubifs_next_log_lnum(c, lnum);
726 destroy_done_tree(&done_tree);
739 static int dbg_check_bud_bytes(
struct ubifs_info *c)
743 long long bud_bytes = 0;
745 if (!dbg_is_chk_gen(c))
754 ubifs_err(
"bad bud_bytes %lld, calculated %lld",