Lines Matching refs:lnum
129 static void upd_ltab(struct ubifs_info *c, int lnum, int free, int dirty) in upd_ltab() argument
132 lnum, c->ltab[lnum - c->lpt_first].free, in upd_ltab()
133 c->ltab[lnum - c->lpt_first].dirty, free, dirty); in upd_ltab()
134 ubifs_assert(c, lnum >= c->lpt_first && lnum <= c->lpt_last); in upd_ltab()
135 c->ltab[lnum - c->lpt_first].free = free; in upd_ltab()
136 c->ltab[lnum - c->lpt_first].dirty += dirty; in upd_ltab()
149 static int alloc_lpt_leb(struct ubifs_info *c, int *lnum) in alloc_lpt_leb() argument
153 n = *lnum - c->lpt_first + 1; in alloc_lpt_leb()
159 *lnum = i + c->lpt_first; in alloc_lpt_leb()
169 *lnum = i + c->lpt_first; in alloc_lpt_leb()
184 int lnum, offs, len, alen, done_lsave, done_ltab, err; in layout_cnodes() local
193 lnum = c->nhead_lnum; in layout_cnodes()
200 c->lsave_lnum = lnum; in layout_cnodes()
208 c->ltab_lnum = lnum; in layout_cnodes()
224 upd_ltab(c, lnum, c->leb_size - alen, alen - offs); in layout_cnodes()
226 err = alloc_lpt_leb(c, &lnum); in layout_cnodes()
230 ubifs_assert(c, lnum >= c->lpt_first && in layout_cnodes()
231 lnum <= c->lpt_last); in layout_cnodes()
235 c->lsave_lnum = lnum; in layout_cnodes()
243 c->ltab_lnum = lnum; in layout_cnodes()
252 cnode->parent->nbranch[cnode->iip].lnum = lnum; in layout_cnodes()
255 c->lpt_lnum = lnum; in layout_cnodes()
267 upd_ltab(c, lnum, c->leb_size - alen, alen - offs); in layout_cnodes()
269 err = alloc_lpt_leb(c, &lnum); in layout_cnodes()
273 ubifs_assert(c, lnum >= c->lpt_first && in layout_cnodes()
274 lnum <= c->lpt_last); in layout_cnodes()
277 c->lsave_lnum = lnum; in layout_cnodes()
287 upd_ltab(c, lnum, c->leb_size - alen, alen - offs); in layout_cnodes()
289 err = alloc_lpt_leb(c, &lnum); in layout_cnodes()
293 ubifs_assert(c, lnum >= c->lpt_first && in layout_cnodes()
294 lnum <= c->lpt_last); in layout_cnodes()
296 c->ltab_lnum = lnum; in layout_cnodes()
303 upd_ltab(c, lnum, c->leb_size - alen, alen - offs); in layout_cnodes()
312 lnum, offs, len, done_ltab, done_lsave); in layout_cnodes()
333 static int realloc_lpt_leb(struct ubifs_info *c, int *lnum) in realloc_lpt_leb() argument
337 n = *lnum - c->lpt_first + 1; in realloc_lpt_leb()
341 *lnum = i + c->lpt_first; in realloc_lpt_leb()
348 *lnum = i + c->lpt_first; in realloc_lpt_leb()
362 int lnum, offs, len, from, err, wlen, alen, done_ltab, done_lsave; in write_cnodes() local
369 lnum = c->nhead_lnum; in write_cnodes()
374 err = ubifs_leb_unmap(c, lnum); in write_cnodes()
406 err = ubifs_leb_write(c, lnum, buf + from, from, in write_cnodes()
412 err = realloc_lpt_leb(c, &lnum); in write_cnodes()
416 ubifs_assert(c, lnum >= c->lpt_first && in write_cnodes()
417 lnum <= c->lpt_last); in write_cnodes()
418 err = ubifs_leb_unmap(c, lnum); in write_cnodes()
465 err = ubifs_leb_write(c, lnum, buf + from, from, alen); in write_cnodes()
469 err = realloc_lpt_leb(c, &lnum); in write_cnodes()
473 ubifs_assert(c, lnum >= c->lpt_first && in write_cnodes()
474 lnum <= c->lpt_last); in write_cnodes()
475 err = ubifs_leb_unmap(c, lnum); in write_cnodes()
491 err = ubifs_leb_write(c, lnum, buf + from, from, alen); in write_cnodes()
495 err = realloc_lpt_leb(c, &lnum); in write_cnodes()
499 ubifs_assert(c, lnum >= c->lpt_first && in write_cnodes()
500 lnum <= c->lpt_last); in write_cnodes()
501 err = ubifs_leb_unmap(c, lnum); in write_cnodes()
514 err = ubifs_leb_write(c, lnum, buf + from, from, alen); in write_cnodes()
523 c->nhead_lnum = lnum; in write_cnodes()
536 lnum, offs, len, done_ltab, done_lsave); in write_cnodes()
561 if (nnode->nbranch[iip].lnum) in next_pnode_to_dirty()
572 if (nnode->nbranch[iip].lnum) in next_pnode_to_dirty()
585 if (nnode->nbranch[iip].lnum) in next_pnode_to_dirty()
601 if (nnode->nbranch[iip].lnum) in next_pnode_to_dirty()
616 ubifs_add_lpt_dirt(c, pnode->parent->nbranch[pnode->iip].lnum, in add_pnode_dirt()
777 c->lsave[cnt++] = lprops->lnum; in populate_lsave()
782 c->lsave[cnt++] = lprops->lnum; in populate_lsave()
787 c->lsave[cnt++] = lprops->lnum; in populate_lsave()
793 c->lsave[cnt++] = heap->arr[i]->lnum; in populate_lsave()
799 c->lsave[cnt++] = heap->arr[i]->lnum; in populate_lsave()
805 c->lsave[cnt++] = heap->arr[i]->lnum; in populate_lsave()
860 static int make_nnode_dirty(struct ubifs_info *c, int node_num, int lnum, in make_nnode_dirty() argument
872 if (branch->lnum != lnum || branch->offs != offs) in make_nnode_dirty()
874 } else if (c->lpt_lnum != lnum || c->lpt_offs != offs) in make_nnode_dirty()
909 static int make_pnode_dirty(struct ubifs_info *c, int node_num, int lnum, in make_pnode_dirty() argument
919 if (branch->lnum != lnum || branch->offs != offs) in make_pnode_dirty()
939 static int make_ltab_dirty(struct ubifs_info *c, int lnum, int offs) in make_ltab_dirty() argument
941 if (lnum != c->ltab_lnum || offs != c->ltab_offs) in make_ltab_dirty()
964 static int make_lsave_dirty(struct ubifs_info *c, int lnum, int offs) in make_lsave_dirty() argument
966 if (lnum != c->lsave_lnum || offs != c->lsave_offs) in make_lsave_dirty()
992 int lnum, int offs) in make_node_dirty() argument
996 return make_nnode_dirty(c, node_num, lnum, offs); in make_node_dirty()
998 return make_pnode_dirty(c, node_num, lnum, offs); in make_node_dirty()
1000 return make_ltab_dirty(c, lnum, offs); in make_node_dirty()
1002 return make_lsave_dirty(c, lnum, offs); in make_node_dirty()
1105 static int lpt_gc_lnum(struct ubifs_info *c, int lnum) in lpt_gc_lnum() argument
1110 dbg_lp("LEB %d", lnum); in lpt_gc_lnum()
1112 err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1); in lpt_gc_lnum()
1133 err = make_node_dirty(c, node_type, node_num, lnum, offs); in lpt_gc_lnum()
1152 int i, lnum = -1, dirty = 0; in lpt_gc() local
1162 lnum = i + c->lpt_first; in lpt_gc()
1166 if (lnum == -1) in lpt_gc()
1168 return lpt_gc_lnum(c, lnum); in lpt_gc()
1476 static int dbg_is_nnode_dirty(struct ubifs_info *c, int lnum, int offs) in dbg_is_nnode_dirty() argument
1489 if (branch->lnum != lnum || branch->offs != offs) in dbg_is_nnode_dirty()
1495 if (c->lpt_lnum != lnum || c->lpt_offs != offs) in dbg_is_nnode_dirty()
1511 static int dbg_is_pnode_dirty(struct ubifs_info *c, int lnum, int offs) in dbg_is_pnode_dirty() argument
1525 if (branch->lnum != lnum || branch->offs != offs) in dbg_is_pnode_dirty()
1540 static int dbg_is_ltab_dirty(struct ubifs_info *c, int lnum, int offs) in dbg_is_ltab_dirty() argument
1542 if (lnum != c->ltab_lnum || offs != c->ltab_offs) in dbg_is_ltab_dirty()
1553 static int dbg_is_lsave_dirty(struct ubifs_info *c, int lnum, int offs) in dbg_is_lsave_dirty() argument
1555 if (lnum != c->lsave_lnum || offs != c->lsave_offs) in dbg_is_lsave_dirty()
1567 static int dbg_is_node_dirty(struct ubifs_info *c, int node_type, int lnum, in dbg_is_node_dirty() argument
1572 return dbg_is_nnode_dirty(c, lnum, offs); in dbg_is_node_dirty()
1574 return dbg_is_pnode_dirty(c, lnum, offs); in dbg_is_node_dirty()
1576 return dbg_is_ltab_dirty(c, lnum, offs); in dbg_is_node_dirty()
1578 return dbg_is_lsave_dirty(c, lnum, offs); in dbg_is_node_dirty()
1590 static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum) in dbg_check_ltab_lnum() argument
1605 dbg_lp("LEB %d", lnum); in dbg_check_ltab_lnum()
1607 err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1); in dbg_check_ltab_lnum()
1624 lnum, c->leb_size - len); in dbg_check_ltab_lnum()
1627 i = lnum - c->lpt_first; in dbg_check_ltab_lnum()
1630 lnum, len, c->ltab[i].free); in dbg_check_ltab_lnum()
1635 lnum, dirty, c->ltab[i].dirty); in dbg_check_ltab_lnum()
1642 ret = dbg_is_node_dirty(c, node_type, lnum, c->leb_size - len); in dbg_check_ltab_lnum()
1663 int lnum, err, i, cnt; in dbg_check_ltab() local
1685 for (lnum = c->lpt_first; lnum <= c->lpt_last; lnum++) { in dbg_check_ltab()
1686 err = dbg_check_ltab_lnum(c, lnum); in dbg_check_ltab()
1688 ubifs_err(c, "failed at LEB %d", lnum); in dbg_check_ltab()
1842 static void dump_lpt_leb(const struct ubifs_info *c, int lnum) in dump_lpt_leb() argument
1847 pr_err("(pid %d) start dumping LEB %d\n", current->pid, lnum); in dump_lpt_leb()
1854 err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1); in dump_lpt_leb()
1866 lnum, offs, pad_len); in dump_lpt_leb()
1873 lnum, offs, len); in dump_lpt_leb()
1884 lnum, offs, node_num); in dump_lpt_leb()
1886 pr_err("LEB %d:%d, pnode\n", lnum, offs); in dump_lpt_leb()
1897 lnum, offs, node_num); in dump_lpt_leb()
1900 lnum, offs); in dump_lpt_leb()
1908 pr_cont("%d:%d", nnode.nbranch[i].lnum, in dump_lpt_leb()
1918 pr_err("LEB %d:%d, ltab\n", lnum, offs); in dump_lpt_leb()
1922 pr_err("LEB %d:%d, lsave len\n", lnum, offs); in dump_lpt_leb()
1933 pr_err("(pid %d) finish dumping LEB %d\n", current->pid, lnum); in dump_lpt_leb()
1980 c->lsave[get_random_u32_below(c->lsave_cnt)] = lprops->lnum; in dbg_populate_lsave()
1982 c->lsave[get_random_u32_below(c->lsave_cnt)] = lprops->lnum; in dbg_populate_lsave()
1984 c->lsave[get_random_u32_below(c->lsave_cnt)] = lprops->lnum; in dbg_populate_lsave()
1988 c->lsave[get_random_u32_below(c->lsave_cnt)] = heap->arr[i]->lnum; in dbg_populate_lsave()
1991 c->lsave[get_random_u32_below(c->lsave_cnt)] = heap->arr[i]->lnum; in dbg_populate_lsave()
1994 c->lsave[get_random_u32_below(c->lsave_cnt)] = heap->arr[i]->lnum; in dbg_populate_lsave()