Lines Matching refs:offs

101 	int err, offs, len;  in get_master_node()  local
113 offs = 0; in get_master_node()
116 while (offs + UBIFS_MST_NODE_SZ <= c->leb_size) { in get_master_node()
121 offs += sz; in get_master_node()
126 if (offs) { in get_master_node()
129 offs -= sz; in get_master_node()
132 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
133 if (ret != SCANNED_A_NODE && offs) { in get_master_node()
135 offs -= sz; 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()
154 offs += sz; in get_master_node()
160 if (offs < c->leb_size) { in get_master_node()
163 dbg_rcvry("found corruption at %d:%d", lnum, offs); in get_master_node()
165 offs += sz; in get_master_node()
170 if (offs < c->leb_size) in get_master_node()
402 static int is_last_write(const struct ubifs_info *c, void *buf, int offs) in is_last_write() argument
411 empty_offs = ALIGN(offs + 1, c->max_write_size); in is_last_write()
413 p = buf + empty_offs - offs; in is_last_write()
430 int *offs, int *len) in clean_buf() argument
434 dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs); in clean_buf()
436 ubifs_assert(c, !(*offs & 7)); in clean_buf()
437 empty_offs = ALIGN(*offs, c->min_io_size); in clean_buf()
438 pad_len = empty_offs - *offs; in clean_buf()
440 *offs += pad_len; in clean_buf()
459 int lnum, int offs) in no_more_nodes() argument
465 skip = ALIGN(offs + UBIFS_CH_SZ, c->max_write_size) - offs; in no_more_nodes()
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()
477 skip = ALIGN(offs + dlen, c->max_write_size) - offs; in no_more_nodes()
481 dbg_rcvry("unexpected data at %d:%d", lnum, offs + skip); in no_more_nodes()
502 endpt = snod->offs + snod->len; in fix_unclean_leb()
562 static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs) in drop_last_group() argument
575 sleb->lnum, snod->offs); in drop_last_group()
576 *offs = snod->offs; in drop_last_group()
591 static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs) in drop_last_node() argument
600 sleb->lnum, snod->offs); in drop_last_node()
601 *offs = snod->offs; in drop_last_node()
623 int offs, void *sbuf, int jhead) in ubifs_recover_leb() argument
625 int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit; in ubifs_recover_leb()
628 void *buf = sbuf + offs; in ubifs_recover_leb()
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()
653 err = ubifs_add_snod(c, sleb, buf, offs); in ubifs_recover_leb()
657 offs += node_len; in ubifs_recover_leb()
662 offs += ret; in ubifs_recover_leb()
670 ret, lnum, offs); in ubifs_recover_leb()
680 if (!is_last_write(c, buf, offs)) in ubifs_recover_leb()
683 if (!no_more_nodes(c, buf, len, lnum, offs)) in ubifs_recover_leb()
686 if (!is_last_write(c, buf, offs)) { in ubifs_recover_leb()
694 lnum, offs, corruption); in ubifs_recover_leb()
696 offs += corruption; in ubifs_recover_leb()
702 min_io_unit = round_down(offs, c->min_io_size); in ubifs_recover_leb()
708 drop_last_group(sleb, &offs); in ubifs_recover_leb()
761 while (offs > min_io_unit) in ubifs_recover_leb()
762 drop_last_node(sleb, &offs); in ubifs_recover_leb()
765 buf = sbuf + offs; in ubifs_recover_leb()
766 len = c->leb_size - offs; 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()
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()
809 if (c->leb_size - offs < UBIFS_CS_NODE_SZ) 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()
857 int offs, void *sbuf) in ubifs_recover_log_leb() argument
883 err = get_cs_sqnum(c, lnum, offs, &cs_sqnum); 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
916 if (offs + len > c->leb_size) in recover_head()
917 len = c->leb_size - offs; in recover_head()
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()
926 if (offs == 0) 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
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()
1013 offs += node_len; in clean_an_unclean_leb()
1021 offs += ret; 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()
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()
1170 err = ubifs_find_dirty_leb(c, &lp, wbuf->offs, 2); in ubifs_rcvry_gc_commit()
1180 ubifs_assert(c, lp.free + lp.dirty >= wbuf->offs); 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()
1428 ino = c->sbuf + offs; in fix_size_in_place()
1444 (unsigned long)e->inum, lnum, offs, i_size, e->d_size); in fix_size_in_place()