Lines Matching refs:offs

113 	int err, offs, len;  in get_master_node()  local
125 offs = 0; in get_master_node()
128 while (offs + UBIFS_MST_NODE_SZ <= c->leb_size) { in get_master_node()
133 offs += sz; in get_master_node()
138 if (offs) { in get_master_node()
141 offs -= sz; in get_master_node()
144 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
145 if (ret != SCANNED_A_NODE && offs) { in get_master_node()
147 offs -= sz; in get_master_node()
150 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
164 dbg_rcvry("found a master node at %d:%d", lnum, offs); in get_master_node()
166 offs += sz; in get_master_node()
172 if (offs < c->leb_size) { in get_master_node()
175 dbg_rcvry("found corruption at %d:%d", lnum, offs); in get_master_node()
177 offs += sz; in get_master_node()
182 if (offs < c->leb_size) in get_master_node()
413 static int is_last_write(const struct ubifs_info *c, void *buf, int offs) in is_last_write() argument
422 empty_offs = ALIGN(offs + 1, c->max_write_size); in is_last_write()
424 p = buf + empty_offs - offs; in is_last_write()
441 int *offs, int *len) in clean_buf() argument
446 dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs); in clean_buf()
448 ubifs_assert(!(*offs & 7)); in clean_buf()
449 empty_offs = ALIGN(*offs, c->min_io_size); in clean_buf()
450 pad_len = empty_offs - *offs; in clean_buf()
452 *offs += pad_len; in clean_buf()
471 int lnum, int offs) in no_more_nodes() argument
477 skip = ALIGN(offs + UBIFS_CH_SZ, c->max_write_size) - offs; in no_more_nodes()
484 if (ubifs_check_node(c, buf, lnum, offs, 1, 0) != -EUCLEAN) { in no_more_nodes()
485 dbg_rcvry("unexpected bad common header at %d:%d", lnum, offs); in no_more_nodes()
489 skip = ALIGN(offs + dlen, c->max_write_size) - offs; in no_more_nodes()
493 dbg_rcvry("unexpected data at %d:%d", lnum, offs + skip); in no_more_nodes()
514 endpt = snod->offs + snod->len; in fix_unclean_leb()
574 static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs) in drop_last_group() argument
587 sleb->lnum, snod->offs); in drop_last_group()
588 *offs = snod->offs; in drop_last_group()
603 static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs) in drop_last_node() argument
612 sleb->lnum, snod->offs); in drop_last_node()
613 *offs = snod->offs; in drop_last_node()
635 int offs, void *sbuf, int jhead) in ubifs_recover_leb() argument
637 int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit; in ubifs_recover_leb()
640 void *buf = sbuf + offs; in ubifs_recover_leb()
642 dbg_rcvry("%d:%d, jhead %d, grouped %d", lnum, offs, jhead, grouped); in ubifs_recover_leb()
644 sleb = ubifs_start_scan(c, lnum, offs, sbuf); in ubifs_recover_leb()
651 lnum, offs, len); in ubifs_recover_leb()
659 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in ubifs_recover_leb()
665 err = ubifs_add_snod(c, sleb, buf, offs); in ubifs_recover_leb()
669 offs += node_len; in ubifs_recover_leb()
674 offs += ret; in ubifs_recover_leb()
682 ret, lnum, offs); in ubifs_recover_leb()
692 if (!is_last_write(c, buf, offs)) in ubifs_recover_leb()
695 if (!no_more_nodes(c, buf, len, lnum, offs)) in ubifs_recover_leb()
698 if (!is_last_write(c, buf, offs)) { in ubifs_recover_leb()
706 lnum, offs, corruption); in ubifs_recover_leb()
708 offs += corruption; in ubifs_recover_leb()
714 min_io_unit = round_down(offs, c->min_io_size); in ubifs_recover_leb()
720 drop_last_group(sleb, &offs); in ubifs_recover_leb()
773 while (offs > min_io_unit) in ubifs_recover_leb()
774 drop_last_node(sleb, &offs); in ubifs_recover_leb()
777 buf = sbuf + offs; in ubifs_recover_leb()
778 len = c->leb_size - offs; in ubifs_recover_leb()
780 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
781 ubifs_end_scan(c, sleb, lnum, offs); in ubifs_recover_leb()
792 ubifs_scan_a_node(c, buf, len, lnum, offs, 0); in ubifs_recover_leb()
794 ubifs_scanned_corruption(c, lnum, offs, buf); in ubifs_recover_leb()
811 static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs, in get_cs_sqnum() argument
817 dbg_rcvry("at %d:%d", lnum, offs); in get_cs_sqnum()
821 if (c->leb_size - offs < UBIFS_CS_NODE_SZ) in get_cs_sqnum()
823 err = ubifs_leb_read(c, lnum, (void *)cs_node, offs, in get_cs_sqnum()
827 ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0); in get_cs_sqnum()
869 int offs, void *sbuf) in ubifs_recover_log_leb() argument
895 err = get_cs_sqnum(c, lnum, offs, &cs_sqnum); in ubifs_recover_log_leb()
910 return ubifs_recover_leb(c, lnum, offs, sbuf, -1); in ubifs_recover_log_leb()
924 static int recover_head(struct ubifs_info *c, int lnum, int offs, void *sbuf) in recover_head() argument
928 if (offs + len > c->leb_size) in recover_head()
929 len = c->leb_size - offs; in recover_head()
935 err = ubifs_leb_read(c, lnum, sbuf, offs, len, 1); in recover_head()
937 dbg_rcvry("cleaning head at %d:%d", lnum, offs); in recover_head()
938 if (offs == 0) in recover_head()
940 err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1); in recover_head()
943 return ubifs_leb_change(c, lnum, sbuf, offs); in recover_head()
997 int err, lnum = ucleb->lnum, offs = 0, len = ucleb->endpt, quiet = 1; in clean_an_unclean_leb() local
1007 err = ubifs_leb_read(c, lnum, buf, offs, len, 0); in clean_an_unclean_leb()
1017 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet); in clean_an_unclean_leb()
1025 offs += node_len; in clean_an_unclean_leb()
1033 offs += ret; in clean_an_unclean_leb()
1041 lnum, offs); in clean_an_unclean_leb()
1051 ubifs_scanned_corruption(c, lnum, offs, buf); in clean_an_unclean_leb()
1176 dbg_rcvry("GC head LEB %d, offs %d", wbuf->lnum, wbuf->offs); in ubifs_rcvry_gc_commit()
1179 if (wbuf->lnum == -1 || wbuf->offs == c->leb_size) in ubifs_rcvry_gc_commit()
1182 err = ubifs_find_dirty_leb(c, &lp, wbuf->offs, 2); in ubifs_rcvry_gc_commit()
1192 ubifs_assert(lp.free + lp.dirty >= wbuf->offs); in ubifs_rcvry_gc_commit()
1419 int err, lnum, offs, len; in fix_size_in_place() local
1425 err = ubifs_tnc_locate(c, &key, ino, &lnum, &offs); in fix_size_in_place()
1440 ino = c->sbuf + offs; in fix_size_in_place()
1456 (unsigned long)e->inum, lnum, offs, i_size, e->d_size); in fix_size_in_place()