Lines Matching refs:offs

106 	int err, offs, len;  in get_master_node()  local
118 offs = 0; in get_master_node()
121 while (offs + UBIFS_MST_NODE_SZ <= c->leb_size) { in get_master_node()
126 offs += sz; in get_master_node()
131 if (offs) { in get_master_node()
134 offs -= sz; in get_master_node()
137 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
138 if (ret != SCANNED_A_NODE && offs) { in get_master_node()
140 offs -= sz; in get_master_node()
143 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
157 dbg_rcvry("found a master node at %d:%d", lnum, offs); in get_master_node()
159 offs += sz; in get_master_node()
165 if (offs < c->leb_size) { in get_master_node()
168 dbg_rcvry("found corruption at %d:%d", lnum, offs); in get_master_node()
170 offs += sz; in get_master_node()
175 if (offs < c->leb_size) in get_master_node()
408 static int is_last_write(const struct ubifs_info *c, void *buf, int offs) in is_last_write() argument
417 empty_offs = ALIGN(offs + 1, c->max_write_size); in is_last_write()
419 p = buf + empty_offs - offs; in is_last_write()
436 int *offs, int *len) in clean_buf() argument
441 dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs); in clean_buf()
443 ubifs_assert(!(*offs & 7)); in clean_buf()
444 empty_offs = ALIGN(*offs, c->min_io_size); in clean_buf()
445 pad_len = empty_offs - *offs; in clean_buf()
447 *offs += pad_len; in clean_buf()
466 int lnum, int offs) in no_more_nodes() argument
472 skip = ALIGN(offs + UBIFS_CH_SZ, c->max_write_size) - offs; in no_more_nodes()
479 if (ubifs_check_node(c, buf, lnum, offs, 1, 0) != -EUCLEAN) { in no_more_nodes()
480 dbg_rcvry("unexpected bad common header at %d:%d", lnum, offs); in no_more_nodes()
484 skip = ALIGN(offs + dlen, c->max_write_size) - offs; in no_more_nodes()
488 dbg_rcvry("unexpected data at %d:%d", lnum, offs + skip); in no_more_nodes()
509 endpt = snod->offs + snod->len; in fix_unclean_leb()
571 static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs) in drop_last_group() argument
584 sleb->lnum, snod->offs); in drop_last_group()
585 *offs = snod->offs; in drop_last_group()
600 static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs) in drop_last_node() argument
609 sleb->lnum, snod->offs); in drop_last_node()
610 *offs = snod->offs; in drop_last_node()
632 int offs, void *sbuf, int jhead) in ubifs_recover_leb() argument
634 int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit; in ubifs_recover_leb()
637 void *buf = sbuf + offs; in ubifs_recover_leb()
639 dbg_rcvry("%d:%d, jhead %d, grouped %d", lnum, offs, jhead, grouped); in ubifs_recover_leb()
641 sleb = ubifs_start_scan(c, lnum, offs, sbuf); in ubifs_recover_leb()
648 lnum, offs, len); in ubifs_recover_leb()
656 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in ubifs_recover_leb()
662 err = ubifs_add_snod(c, sleb, buf, offs); in ubifs_recover_leb()
666 offs += node_len; in ubifs_recover_leb()
671 offs += ret; in ubifs_recover_leb()
679 ret, lnum, offs); in ubifs_recover_leb()
689 if (!is_last_write(c, buf, offs)) in ubifs_recover_leb()
692 if (!no_more_nodes(c, buf, len, lnum, offs)) in ubifs_recover_leb()
695 if (!is_last_write(c, buf, offs)) { in ubifs_recover_leb()
703 lnum, offs, corruption); in ubifs_recover_leb()
705 offs += corruption; in ubifs_recover_leb()
711 min_io_unit = round_down(offs, c->min_io_size); in ubifs_recover_leb()
717 drop_last_group(sleb, &offs); in ubifs_recover_leb()
770 while (offs > min_io_unit) in ubifs_recover_leb()
771 drop_last_node(sleb, &offs); in ubifs_recover_leb()
774 buf = sbuf + offs; in ubifs_recover_leb()
775 len = c->leb_size - offs; in ubifs_recover_leb()
777 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
778 ubifs_end_scan(c, sleb, lnum, offs); in ubifs_recover_leb()
789 ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in ubifs_recover_leb()
791 ubifs_scanned_corruption(c, lnum, offs, buf); in ubifs_recover_leb()
808 static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs, in get_cs_sqnum() argument
814 dbg_rcvry("at %d:%d", lnum, offs); in get_cs_sqnum()
818 if (c->leb_size - offs < UBIFS_CS_NODE_SZ) in get_cs_sqnum()
820 err = ubifs_leb_read(c, lnum, (void *)cs_node, offs, in get_cs_sqnum()
824 ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0); in get_cs_sqnum()
866 int offs, void *sbuf) in ubifs_recover_log_leb() argument
892 err = get_cs_sqnum(c, lnum, offs, &cs_sqnum); in ubifs_recover_log_leb()
907 return ubifs_recover_leb(c, lnum, offs, sbuf, -1); in ubifs_recover_log_leb()
921 static int recover_head(struct ubifs_info *c, int lnum, int offs, void *sbuf) in recover_head() argument
925 if (offs + len > c->leb_size) in recover_head()
926 len = c->leb_size - offs; in recover_head()
932 err = ubifs_leb_read(c, lnum, sbuf, offs, len, 1); in recover_head()
934 dbg_rcvry("cleaning head at %d:%d", lnum, offs); in recover_head()
935 if (offs == 0) in recover_head()
937 err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1); in recover_head()
940 return ubifs_leb_change(c, lnum, sbuf, offs); in recover_head()
994 int err, lnum = ucleb->lnum, offs = 0, len = ucleb->endpt, quiet = 1; in clean_an_unclean_leb() local
1004 err = ubifs_leb_read(c, lnum, buf, offs, len, 0); in clean_an_unclean_leb()
1014 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet); in clean_an_unclean_leb()
1022 offs += node_len; in clean_an_unclean_leb()
1030 offs += ret; in clean_an_unclean_leb()
1038 lnum, offs); in clean_an_unclean_leb()
1048 ubifs_scanned_corruption(c, lnum, offs, buf); in clean_an_unclean_leb()
1174 dbg_rcvry("GC head LEB %d, offs %d", wbuf->lnum, wbuf->offs); in ubifs_rcvry_gc_commit()
1177 if (wbuf->lnum == -1 || wbuf->offs == c->leb_size) in ubifs_rcvry_gc_commit()
1180 err = ubifs_find_dirty_leb(c, &lp, wbuf->offs, 2); in ubifs_rcvry_gc_commit()
1190 ubifs_assert(lp.free + lp.dirty >= wbuf->offs); in ubifs_rcvry_gc_commit()
1425 int err, lnum, offs, len; in fix_size_in_place() local
1431 err = ubifs_tnc_locate(c, &key, ino, &lnum, &offs); in fix_size_in_place()
1446 ino = c->sbuf + offs; in fix_size_in_place()
1462 (unsigned long)e->inum, lnum, offs, i_size, e->d_size); in fix_size_in_place()