Lines Matching refs:offs

101 	int err, offs, len;
113 offs = 0;
116 while (offs + UBIFS_MST_NODE_SZ <= c->leb_size) {
121 offs += sz;
126 if (offs) {
129 offs -= sz;
132 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
133 if (ret != SCANNED_A_NODE && offs) {
135 offs -= sz;
138 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
152 dbg_rcvry("found a master node at %d:%d", lnum, offs);
154 offs += sz;
160 if (offs < c->leb_size) {
163 dbg_rcvry("found corruption at %d:%d", lnum, offs);
165 offs += sz;
170 if (offs < c->leb_size)
395 * @offs: offset to check
397 * This function returns %1 if @offs was in the last write to the LEB whose data
402 static int is_last_write(const struct ubifs_info *c, void *buf, int offs)
408 * Round up to the next @c->max_write_size boundary i.e. @offs is in
411 empty_offs = ALIGN(offs + 1, c->max_write_size);
413 p = buf + empty_offs - offs;
422 * @offs: offset from which to clean
426 * sets empty space to all 0xff. @buf, @offs and @len are updated to the next
430 int *offs, int *len)
434 dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs);
436 ubifs_assert(c, !(*offs & 7));
437 empty_offs = ALIGN(*offs, c->min_io_size);
438 pad_len = empty_offs - *offs;
440 *offs += pad_len;
452 * @offs: offset from which @buf was read
454 * This function ensures that the corrupted node at @offs is the last thing
459 int lnum, int offs)
465 skip = ALIGN(offs + UBIFS_CH_SZ, c->max_write_size) - offs;
472 if (ubifs_check_node(c, buf, len, lnum, offs, 1, 0) != -EUCLEAN) {
473 dbg_rcvry("unexpected bad common header at %d:%d", lnum, offs);
477 skip = ALIGN(offs + dlen, c->max_write_size) - offs;
481 dbg_rcvry("unexpected data at %d:%d", lnum, offs + skip);
502 endpt = snod->offs + snod->len;
557 * @offs: offset of dropped nodes is returned here
562 static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs)
575 sleb->lnum, snod->offs);
576 *offs = snod->offs;
586 * @offs: offset of dropped nodes is returned here
591 static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs)
600 sleb->lnum, snod->offs);
601 *offs = snod->offs;
612 * @offs: offset
623 int offs, void *sbuf, int jhead)
625 int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit;
628 void *buf = sbuf + offs;
630 dbg_rcvry("%d:%d, jhead %d, grouped %d", lnum, offs, jhead, grouped);
632 sleb = ubifs_start_scan(c, lnum, offs, sbuf);
639 lnum, offs, len);
647 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
653 err = ubifs_add_snod(c, sleb, buf, offs);
657 offs += node_len;
662 offs += ret;
670 ret, lnum, offs);
680 if (!is_last_write(c, buf, offs))
683 if (!no_more_nodes(c, buf, len, lnum, offs))
686 if (!is_last_write(c, buf, offs)) {
694 lnum, offs, corruption);
696 offs += corruption;
702 min_io_unit = round_down(offs, c->min_io_size);
708 drop_last_group(sleb, &offs);
761 while (offs > min_io_unit)
762 drop_last_node(sleb, &offs);
765 buf = sbuf + offs;
766 len = c->leb_size - offs;
768 clean_buf(c, &buf, lnum, &offs, &len);
769 ubifs_end_scan(c, sleb, lnum, offs);
780 ubifs_scan_a_node(c, buf, len, lnum, offs, 0);
782 ubifs_scanned_corruption(c, lnum, offs, buf);
794 * @offs: offset of commit start node
799 static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs,
805 dbg_rcvry("at %d:%d", lnum, offs);
809 if (c->leb_size - offs < UBIFS_CS_NODE_SZ)
811 err = ubifs_leb_read(c, lnum, (void *)cs_node, offs,
815 ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0);
847 * @offs: offset
857 int offs, void *sbuf)
883 err = get_cs_sqnum(c, lnum, offs, &cs_sqnum);
898 return ubifs_recover_leb(c, lnum, offs, sbuf, -1);
905 * @offs: offset of head to recover
912 static int recover_head(struct ubifs_info *c, int lnum, int offs, void *sbuf)
916 if (offs + len > c->leb_size)
917 len = c->leb_size - offs;
923 err = ubifs_leb_read(c, lnum, sbuf, offs, len, 1);
925 dbg_rcvry("cleaning head at %d:%d", lnum, offs);
926 if (offs == 0)
928 err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1);
931 return ubifs_leb_change(c, lnum, sbuf, offs);
985 int err, lnum = ucleb->lnum, offs = 0, len = ucleb->endpt, quiet = 1;
995 err = ubifs_leb_read(c, lnum, buf, offs, len, 0);
1005 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet);
1013 offs += node_len;
1021 offs += ret;
1029 lnum, offs);
1039 ubifs_scanned_corruption(c, lnum, offs, buf);
1164 dbg_rcvry("GC head LEB %d, offs %d", wbuf->lnum, wbuf->offs);
1167 if (wbuf->lnum == -1 || wbuf->offs == c->leb_size)
1170 err = ubifs_find_dirty_leb(c, &lp, wbuf->offs, 2);
1180 ubifs_assert(c, lp.free + lp.dirty >= wbuf->offs);
1407 int err, lnum, offs, len;
1413 err = ubifs_tnc_locate(c, &key, ino, &lnum, &offs);
1428 ino = c->sbuf + offs;
1444 (unsigned long)e->inum, lnum, offs, i_size, e->d_size);