131 dbg_mnt(
"bud LEB %d was GC'd (%d free, %d dirty)", b->
bud->lnum,
133 dbg_gc(
"bud LEB %d was GC'd (%d free, %d dirty)", b->
bud->lnum,
144 dbg_mnt(
"LEB %d lp: %d free %d dirty replay: %d free %d dirty",
160 ubifs_release_lprops(c);
171 static int set_buds_lprops(
struct ubifs_info *c)
177 err = set_bud_lprops(c, b);
192 unsigned min_blk, max_blk;
204 ino = key_inum(c, &r->
key);
206 data_key_init(c, &min_key, ino, min_blk);
207 data_key_init(c, &max_key, ino, max_blk);
223 dbg_mntk(&r->
key,
"LEB %d:%d len %d deletion %d sqnum %llu key ",
229 if (is_hash_key(c, &r->
key)) {
237 switch (key_type(c, &r->
key)) {
246 err = trun_remove_range(c, r);
300 static int apply_replay_list(
struct ubifs_info *c)
310 err = apply_replay_entry(c, r);
324 static void destroy_replay_list(
struct ubifs_info *c)
329 if (is_hash_key(c, &r->
key))
363 dbg_mntk(key,
"add LEB %d:%d, key ", lnum, offs);
373 *used +=
ALIGN(len, 8);
379 key_copy(c, key, &r->
key);
404 static int insert_dent(
struct ubifs_info *c,
int lnum,
int offs,
int len,
406 unsigned long long sqnum,
int deletion,
int *used)
411 dbg_mntk(key,
"add LEB %d:%d, key ", lnum, offs);
426 *used +=
ALIGN(len, 8);
432 key_copy(c, key, &r->
key);
453 int key_type = key_type_flash(c, dent->
key);
462 "directory entry" :
"extended attribute entry");
529 return data == 0xFFFFFFFF;
543 int is_last = is_last_bud(c, b->
bud);
544 int err = 0, used = 0, lnum = b->
bud->lnum, offs = b->
bud->start;
548 dbg_mnt(
"replay bud LEB %d, head %d, offs %d, is_last %d",
549 lnum, b->
bud->jhead, offs, is_last);
562 return PTR_ERR(sleb);
599 switch (snod->
type) {
607 err = insert_node(c, lnum, snod->
offs, snod->
len,
616 key_block(c, &snod->
key) *
619 err = insert_node(c, lnum, snod->
offs, snod->
len,
633 err = insert_dent(c, lnum, snod->
offs, snod->
len,
649 old_size <= new_size) {
659 err = insert_node(c, lnum, snod->
offs, snod->
len,
660 &key, snod->
sqnum, 1, &used,
665 ubifs_err(
"unexpected node type %d in bud LEB %d:%d",
680 dbg_mnt(
"bud LEB %d replied: dirty %d, free %d",
705 unsigned long long prev_sqnum = 0;
708 err = replay_bud(c, b);
713 prev_sqnum = b->
sqnum;
723 static void destroy_bud_list(
struct ubifs_info *c)
745 static int add_replay_bud(
struct ubifs_info *c,
int lnum,
int offs,
int jhead,
746 unsigned long long sqnum)
751 dbg_mnt(
"add replay bud LEB %d:%d, head %d", lnum, offs, jhead);
799 lnum < c->main_first || offs > c->
leb_size ||
806 if (bud->
jhead == jhead && bud->
start <= offs)
808 ubifs_err(
"bud at LEB %d:%d was already referred", lnum, offs);
826 static int replay_log_leb(
struct ubifs_info *c,
int lnum,
int offs,
void *sbuf)
833 dbg_mnt(
"replay log LEB %d:%d", lnum, offs);
837 return PTR_ERR(sleb);
845 return PTR_ERR(sleb);
864 ubifs_err(
"first log node at LEB %d:%d is not CS node",
869 ubifs_err(
"first CS node at LEB %d:%d has wrong commit number %llu expected %llu",
893 if (snod->
offs != 0) {
894 ubifs_err(
"first node is not at zero offset");
907 ubifs_err(
"bad sqnum %llu, commit sqnum %llu",
915 switch (snod->
type) {
919 err = validate_ref(c, ref);
936 if (snod->
offs != 0) {
958 ubifs_err(
"log error detected while replaying the log at LEB %d:%d",
959 lnum, offs + snod->
offs);
996 ubifs_release_lprops(c);
1015 free = take_ihead(c);
1025 dbg_mnt(
"start replaying the journal");
1030 err = replay_log_leb(c, lnum, 0, c->
sbuf);
1036 lnum = ubifs_next_log_lnum(c, lnum);
1039 err = replay_buds(c);
1043 err = apply_replay_list(c);
1047 err = set_buds_lprops(c);
1061 dbg_mnt(
"finished, log head LEB %d:%d, max_sqnum %llu, highest_inum %lu",
1065 destroy_replay_list(c);
1066 destroy_bud_list(c);