Lines Matching refs:offs

105 	int err, offs, len;  in get_master_node()  local
117 offs = 0; in get_master_node()
120 while (offs + UBIFS_MST_NODE_SZ <= c->leb_size) { in get_master_node()
125 offs += sz; in get_master_node()
130 if (offs) { in get_master_node()
133 offs -= sz; in get_master_node()
136 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
137 if (ret != SCANNED_A_NODE && offs) { in get_master_node()
139 offs -= sz; in get_master_node()
142 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
156 dbg_rcvry("found a master node at %d:%d", lnum, offs); in get_master_node()
158 offs += sz; in get_master_node()
164 if (offs < c->leb_size) { in get_master_node()
167 dbg_rcvry("found corruption at %d:%d", lnum, offs); in get_master_node()
169 offs += sz; in get_master_node()
174 if (offs < c->leb_size) in get_master_node()
407 static int is_last_write(const struct ubifs_info *c, void *buf, int offs) in is_last_write() argument
416 empty_offs = ALIGN(offs + 1, c->max_write_size); in is_last_write()
418 p = buf + empty_offs - offs; in is_last_write()
435 int *offs, int *len) in clean_buf() argument
440 dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs); in clean_buf()
442 ubifs_assert(!(*offs & 7)); in clean_buf()
443 empty_offs = ALIGN(*offs, c->min_io_size); in clean_buf()
444 pad_len = empty_offs - *offs; in clean_buf()
446 *offs += pad_len; in clean_buf()
465 int lnum, int offs) in no_more_nodes() argument
471 skip = ALIGN(offs + UBIFS_CH_SZ, c->max_write_size) - offs; in no_more_nodes()
478 if (ubifs_check_node(c, buf, lnum, offs, 1, 0) != -EUCLEAN) { in no_more_nodes()
479 dbg_rcvry("unexpected bad common header at %d:%d", lnum, offs); in no_more_nodes()
483 skip = ALIGN(offs + dlen, c->max_write_size) - offs; in no_more_nodes()
487 dbg_rcvry("unexpected data at %d:%d", lnum, offs + skip); in no_more_nodes()
508 endpt = snod->offs + snod->len; in fix_unclean_leb()
570 static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs) in drop_last_group() argument
583 sleb->lnum, snod->offs); in drop_last_group()
584 *offs = snod->offs; in drop_last_group()
599 static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs) in drop_last_node() argument
608 sleb->lnum, snod->offs); in drop_last_node()
609 *offs = snod->offs; in drop_last_node()
631 int offs, void *sbuf, int jhead) in ubifs_recover_leb() argument
633 int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit; in ubifs_recover_leb()
636 void *buf = sbuf + offs; in ubifs_recover_leb()
638 dbg_rcvry("%d:%d, jhead %d, grouped %d", lnum, offs, jhead, grouped); in ubifs_recover_leb()
640 sleb = ubifs_start_scan(c, lnum, offs, sbuf); in ubifs_recover_leb()
647 lnum, offs, len); in ubifs_recover_leb()
655 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in ubifs_recover_leb()
661 err = ubifs_add_snod(c, sleb, buf, offs); in ubifs_recover_leb()
665 offs += node_len; in ubifs_recover_leb()
670 offs += ret; in ubifs_recover_leb()
678 ret, lnum, offs); in ubifs_recover_leb()
688 if (!is_last_write(c, buf, offs)) in ubifs_recover_leb()
691 if (!no_more_nodes(c, buf, len, lnum, offs)) in ubifs_recover_leb()
694 if (!is_last_write(c, buf, offs)) { in ubifs_recover_leb()
702 lnum, offs, corruption); in ubifs_recover_leb()
704 offs += corruption; in ubifs_recover_leb()
710 min_io_unit = round_down(offs, c->min_io_size); in ubifs_recover_leb()
716 drop_last_group(sleb, &offs); in ubifs_recover_leb()
769 while (offs > min_io_unit) in ubifs_recover_leb()
770 drop_last_node(sleb, &offs); in ubifs_recover_leb()
773 buf = sbuf + offs; in ubifs_recover_leb()
774 len = c->leb_size - offs; in ubifs_recover_leb()
776 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
777 ubifs_end_scan(c, sleb, lnum, offs); in ubifs_recover_leb()
788 ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in ubifs_recover_leb()
790 ubifs_scanned_corruption(c, lnum, offs, buf); in ubifs_recover_leb()
807 static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs, in get_cs_sqnum() argument
813 dbg_rcvry("at %d:%d", lnum, offs); in get_cs_sqnum()
817 if (c->leb_size - offs < UBIFS_CS_NODE_SZ) in get_cs_sqnum()
819 err = ubifs_leb_read(c, lnum, (void *)cs_node, offs, in get_cs_sqnum()
823 ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0); in get_cs_sqnum()
865 int offs, void *sbuf) in ubifs_recover_log_leb() argument
891 err = get_cs_sqnum(c, lnum, offs, &cs_sqnum); in ubifs_recover_log_leb()
906 return ubifs_recover_leb(c, lnum, offs, sbuf, -1); in ubifs_recover_log_leb()
920 static int recover_head(struct ubifs_info *c, int lnum, int offs, void *sbuf) in recover_head() argument
924 if (offs + len > c->leb_size) in recover_head()
925 len = c->leb_size - offs; in recover_head()
931 err = ubifs_leb_read(c, lnum, sbuf, offs, len, 1); in recover_head()
933 dbg_rcvry("cleaning head at %d:%d", lnum, offs); in recover_head()
934 if (offs == 0) in recover_head()
936 err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1); in recover_head()
939 return ubifs_leb_change(c, lnum, sbuf, offs); in recover_head()
993 int err, lnum = ucleb->lnum, offs = 0, len = ucleb->endpt, quiet = 1; in clean_an_unclean_leb() local
1003 err = ubifs_leb_read(c, lnum, buf, offs, len, 0); in clean_an_unclean_leb()
1013 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet); in clean_an_unclean_leb()
1021 offs += node_len; in clean_an_unclean_leb()
1029 offs += ret; in clean_an_unclean_leb()
1037 lnum, offs); in clean_an_unclean_leb()
1047 ubifs_scanned_corruption(c, lnum, offs, buf); in clean_an_unclean_leb()
1173 dbg_rcvry("GC head LEB %d, offs %d", wbuf->lnum, wbuf->offs); in ubifs_rcvry_gc_commit()
1176 if (wbuf->lnum == -1 || wbuf->offs == c->leb_size) in ubifs_rcvry_gc_commit()
1179 err = ubifs_find_dirty_leb(c, &lp, wbuf->offs, 2); in ubifs_rcvry_gc_commit()
1189 ubifs_assert(lp.free + lp.dirty >= wbuf->offs); in ubifs_rcvry_gc_commit()
1424 int err, lnum, offs, len; in fix_size_in_place() local
1430 err = ubifs_tnc_locate(c, &key, ino, &lnum, &offs); in fix_size_in_place()
1445 ino = c->sbuf + offs; in fix_size_in_place()
1461 (unsigned long)e->inum, lnum, offs, i_size, e->d_size); in fix_size_in_place()