Lines Matching refs:lnum
97 static int get_master_node(const struct ubifs_info *c, int lnum, void **pbuf, in get_master_node() argument
108 err = ubifs_leb_read(c, lnum, sbuf, 0, c->leb_size, 0); in get_master_node()
132 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
138 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
152 dbg_rcvry("found a master node at %d:%d", lnum, offs); in get_master_node()
163 dbg_rcvry("found corruption at %d:%d", lnum, offs); in get_master_node()
195 int err = 0, lnum = UBIFS_MST_LNUM, sz = c->mst_node_alsz; in write_rcvrd_mst_node() local
207 err = ubifs_leb_change(c, lnum, mst, sz); in write_rcvrd_mst_node()
210 err = ubifs_leb_change(c, lnum + 1, mst, sz); in write_rcvrd_mst_node()
429 static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, in clean_buf() argument
434 dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs); in clean_buf()
459 int lnum, int offs) in no_more_nodes() argument
472 if (ubifs_check_node(c, buf, len, lnum, offs, 1, 0) != -EUCLEAN) { in no_more_nodes()
473 dbg_rcvry("unexpected bad common header at %d:%d", lnum, offs); in no_more_nodes()
481 dbg_rcvry("unexpected data at %d:%d", lnum, offs + skip); in no_more_nodes()
494 int lnum = sleb->lnum, endpt = start; in fix_unclean_leb() local
510 lnum, start, sleb->endpt); in fix_unclean_leb()
514 ucleb->lnum = lnum; in fix_unclean_leb()
522 lnum, start, sleb->endpt); in fix_unclean_leb()
524 err = ubifs_leb_unmap(c, lnum); in fix_unclean_leb()
531 err = ubifs_leb_read(c, lnum, sleb->buf, 0, in fix_unclean_leb()
546 err = ubifs_leb_change(c, lnum, sleb->buf, len); in fix_unclean_leb()
575 sleb->lnum, snod->offs); in drop_last_group()
600 sleb->lnum, snod->offs); in drop_last_node()
622 struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, in ubifs_recover_leb() argument
630 dbg_rcvry("%d:%d, jhead %d, grouped %d", lnum, offs, jhead, grouped); in ubifs_recover_leb()
632 sleb = ubifs_start_scan(c, lnum, offs, sbuf); in ubifs_recover_leb()
639 lnum, offs, len); in ubifs_recover_leb()
647 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in ubifs_recover_leb()
670 ret, lnum, offs); in ubifs_recover_leb()
683 if (!no_more_nodes(c, buf, len, lnum, offs)) in ubifs_recover_leb()
694 lnum, offs, corruption); in ubifs_recover_leb()
768 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
769 ubifs_end_scan(c, sleb, lnum, offs); in ubifs_recover_leb()
780 ubifs_scan_a_node(c, buf, len, lnum, offs, 0); in ubifs_recover_leb()
782 ubifs_scanned_corruption(c, lnum, offs, buf); in ubifs_recover_leb()
785 ubifs_err(c, "LEB %d scanning failed", lnum); in ubifs_recover_leb()
799 static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs, in get_cs_sqnum() argument
805 dbg_rcvry("at %d:%d", lnum, offs); in get_cs_sqnum()
811 err = ubifs_leb_read(c, lnum, (void *)cs_node, offs, in get_cs_sqnum()
815 ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0); in get_cs_sqnum()
856 struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, in ubifs_recover_log_leb() argument
862 dbg_rcvry("LEB %d", lnum); in ubifs_recover_log_leb()
863 next_lnum = lnum + 1; in ubifs_recover_log_leb()
883 err = get_cs_sqnum(c, lnum, offs, &cs_sqnum); in ubifs_recover_log_leb()
891 lnum); in ubifs_recover_log_leb()
898 return ubifs_recover_leb(c, lnum, offs, sbuf, -1); in ubifs_recover_log_leb()
912 static int recover_head(struct ubifs_info *c, int lnum, int offs, void *sbuf) in recover_head() argument
923 err = ubifs_leb_read(c, lnum, sbuf, offs, len, 1); in recover_head()
925 dbg_rcvry("cleaning head at %d:%d", lnum, offs); in recover_head()
927 return ubifs_leb_unmap(c, lnum); in recover_head()
928 err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1); in recover_head()
931 return ubifs_leb_change(c, lnum, sbuf, offs); in recover_head()
985 int err, lnum = ucleb->lnum, offs = 0, len = ucleb->endpt, quiet = 1; in clean_an_unclean_leb() local
988 dbg_rcvry("LEB %d len %d", lnum, len); in clean_an_unclean_leb()
992 return ubifs_leb_unmap(c, lnum); in clean_an_unclean_leb()
995 err = ubifs_leb_read(c, lnum, buf, offs, len, 0); in clean_an_unclean_leb()
1005 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet); in clean_an_unclean_leb()
1029 lnum, offs); in clean_an_unclean_leb()
1039 ubifs_scanned_corruption(c, lnum, offs, buf); in clean_an_unclean_leb()
1055 err = ubifs_leb_change(c, lnum, sbuf, len); in clean_an_unclean_leb()
1059 dbg_rcvry("cleaned LEB %d", lnum); in clean_an_unclean_leb()
1103 int lnum, err; in grab_empty_leb() local
1120 lnum = ubifs_find_free_leb_for_idx(c); in grab_empty_leb()
1121 if (lnum < 0) { in grab_empty_leb()
1125 return lnum; in grab_empty_leb()
1129 err = ubifs_change_one_lp(c, lnum, LPROPS_NC, LPROPS_NC, 0, in grab_empty_leb()
1134 c->gc_lnum = lnum; in grab_empty_leb()
1135 dbg_rcvry("found empty LEB %d, run commit", lnum); in grab_empty_leb()
1164 dbg_rcvry("GC head LEB %d, offs %d", wbuf->lnum, wbuf->offs); in ubifs_rcvry_gc_commit()
1167 if (wbuf->lnum == -1 || wbuf->offs == c->leb_size) in ubifs_rcvry_gc_commit()
1191 dbg_rcvry("GC'ing LEB %d", lp.lnum); in ubifs_rcvry_gc_commit()
1216 dbg_rcvry("allocated LEB %d for GC", lp.lnum); in ubifs_rcvry_gc_commit()
1407 int err, lnum, offs, len; in fix_size_in_place() local
1413 err = ubifs_tnc_locate(c, &key, ino, &lnum, &offs); in fix_size_in_place()
1424 err = ubifs_leb_read(c, lnum, c->sbuf, 0, c->leb_size, 1); in fix_size_in_place()
1440 err = ubifs_leb_change(c, lnum, c->sbuf, len); in fix_size_in_place()
1444 (unsigned long)e->inum, lnum, offs, i_size, e->d_size); in fix_size_in_place()