Lines Matching refs:lnum

91  * @lnum: LEB number
105 static int get_master_node(const struct ubifs_info *c, int lnum, void **pbuf, struct ubifs_mst_node **mst, void **cor)
116 err = ubifs_leb_read(c, lnum, sbuf, 0, c->leb_size, 0);
142 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
148 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
164 dbg_rcvry("found a master node at %d:%d", lnum, offs);
175 dbg_rcvry("found corruption at %d:%d", lnum, offs);
208 int err = 0, lnum = UBIFS_MST_LNUM, sz = c->mst_node_alsz;
220 err = ubifs_leb_change(c, lnum, mst, sz);
224 err = ubifs_leb_change(c, lnum + 1, mst, sz);
445 * @lnum: LEB number to clean
453 static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, int *offs, int *len)
457 dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs);
474 * @lnum: LEB number of the LEB from which @buf was read
481 static int no_more_nodes(const struct ubifs_info *c, void *buf, int len, int lnum, int offs)
495 if (ubifs_check_node(c, buf, len, lnum, offs, 1, 0) != -EUCLEAN) {
496 dbg_rcvry("unexpected bad common header at %d:%d", lnum, offs);
505 dbg_rcvry("unexpected data at %d:%d", lnum, offs + skip);
517 int lnum = sleb->lnum, endpt = start;
531 dbg_rcvry("need to fix LEB %d start %d endpt %d", lnum, start, sleb->endpt);
536 ucleb->lnum = lnum;
543 dbg_rcvry("fixing LEB %d start %d endpt %d", lnum, start, sleb->endpt);
545 err = ubifs_leb_unmap(c, lnum);
553 err = ubifs_leb_read(c, lnum, sleb->buf, 0, start, 1);
567 err = ubifs_leb_change(c, lnum, sleb->buf, len);
596 dbg_rcvry("dropping grouped node at %d:%d", sleb->lnum, snod->offs);
619 dbg_rcvry("dropping last node at %d:%d", sleb->lnum, snod->offs);
630 * @lnum: LEB number
641 struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf, int jhead)
648 dbg_rcvry("%d:%d, jhead %d, grouped %d", lnum, offs, jhead, grouped);
650 sleb = ubifs_start_scan(c, lnum, offs, sbuf);
657 dbg_scan("look at LEB %d:%d (%d bytes left)", lnum, offs, len);
665 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
685 dbg_rcvry("found corruption (%d) at %d:%d", ret, lnum, offs);
686 if (ubifs_check_node(c, buf, len, lnum, offs, 1, 1) == -EUCLEAN &&
687 !no_more_nodes(c, buf, len, lnum, offs)) {
704 dbg_rcvry("found corruption (%d) at %d:%d", ret, lnum, offs);
718 dbg_rcvry("found corruption (%d) at %d:%d", ret, lnum, offs);
732 if (!no_more_nodes(c, buf, len, lnum, offs)) {
743 ubifs_err(c, "corrupt empty space LEB %d:%d, corruption starts at %d", lnum, offs, corruption);
819 clean_buf(c, &buf, lnum, &offs, &len);
820 ubifs_end_scan(c, sleb, lnum, offs);
832 ubifs_scan_a_node(c, buf, len, lnum, offs, 0);
834 ubifs_scanned_corruption(c, lnum, offs, buf);
837 ubifs_err(c, "LEB %d scanning failed", lnum);
845 * @lnum: LEB number of commit start node
851 static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs, unsigned long long *cs_sqnum)
856 dbg_rcvry("at %d:%d", lnum, offs);
864 err = ubifs_leb_read(c, lnum, (void *)cs_node, offs, UBIFS_CS_NODE_SZ, 0);
868 ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0);
898 * @lnum: LEB number
908 struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf)
913 dbg_rcvry("LEB %d", lnum);
914 next_lnum = lnum + 1;
935 err = get_cs_sqnum(c, lnum, offs, &cs_sqnum);
942 ubifs_err(c, "unrecoverable log corruption in LEB %d", lnum);
949 return ubifs_recover_leb(c, lnum, offs, sbuf, -1);
955 * @lnum: LEB number of head to recover
963 static int recover_head(struct ubifs_info *c, int lnum, int offs, void *sbuf)
976 err = ubifs_leb_read(c, lnum, sbuf, offs, len, 1);
978 dbg_rcvry("cleaning head at %d:%d", lnum, offs);
980 return ubifs_leb_unmap(c, lnum);
982 err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1);
986 return ubifs_leb_change(c, lnum, sbuf, offs);
1040 int err, lnum = ucleb->lnum, offs = 0, len = ucleb->endpt, quiet = 1;
1043 dbg_rcvry("LEB %d len %d", lnum, len);
1047 return ubifs_leb_unmap(c, lnum);
1050 err = ubifs_leb_read(c, lnum, buf, offs, len, 0);
1061 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet);
1083 ubifs_err(c, "unexpected empty space at %d:%d", lnum, offs);
1093 ubifs_scanned_corruption(c, lnum, offs, buf);
1108 err = ubifs_leb_change(c, lnum, sbuf, len);
1113 dbg_rcvry("cleaned LEB %d", lnum);
1157 int lnum, err;
1174 lnum = ubifs_find_free_leb_for_idx(c);
1175 if (lnum < 0) {
1179 return lnum;
1183 err = ubifs_change_one_lp(c, lnum, LPROPS_NC, LPROPS_NC, 0, LPROPS_INDEX, 0);
1188 c->gc_lnum = lnum;
1189 dbg_rcvry("found empty LEB %d, run commit", lnum);
1218 dbg_rcvry("GC head LEB %d, offs %d", wbuf->lnum, wbuf->offs);
1221 if (wbuf->lnum == -1 || wbuf->offs == c->leb_size) {
1248 dbg_rcvry("GC'ing LEB %d", lp.lnum);
1276 dbg_rcvry("allocated LEB %d for GC", lp.lnum);
1476 int err, lnum, offs, len;
1482 err = ubifs_tnc_locate(c, &key, ino, &lnum, &offs);
1495 err = ubifs_leb_read(c, lnum, c->sbuf, 0, c->leb_size, 1);
1513 err = ubifs_leb_change(c, lnum, c->sbuf, len);
1517 dbg_rcvry("inode %lu at %d:%d size %lld -> %lld", (unsigned long)e->inum, lnum, offs, i_size, e->d_size);