Lines Matching defs:lnum

125  * @lnum: LEB number
129 static void upd_ltab(struct ubifs_info *c, int lnum, int free, int dirty)
132 lnum, c->ltab[lnum - c->lpt_first].free,
133 c->ltab[lnum - c->lpt_first].dirty, free, dirty);
134 ubifs_assert(c, lnum >= c->lpt_first && lnum <= c->lpt_last);
135 c->ltab[lnum - c->lpt_first].free = free;
136 c->ltab[lnum - c->lpt_first].dirty += dirty;
142 * @lnum: LEB number is passed and returned here
144 * This function finds the next empty LEB in the ltab starting from @lnum. If a
145 * an empty LEB is found it is returned in @lnum and the function returns %0.
149 static int alloc_lpt_leb(struct ubifs_info *c, int *lnum)
153 n = *lnum - c->lpt_first + 1;
159 *lnum = i + c->lpt_first;
169 *lnum = i + c->lpt_first;
184 int lnum, offs, len, alen, done_lsave, done_ltab, err;
193 lnum = c->nhead_lnum;
200 c->lsave_lnum = lnum;
208 c->ltab_lnum = lnum;
224 upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
226 err = alloc_lpt_leb(c, &lnum);
230 ubifs_assert(c, lnum >= c->lpt_first &&
231 lnum <= c->lpt_last);
235 c->lsave_lnum = lnum;
243 c->ltab_lnum = lnum;
252 cnode->parent->nbranch[cnode->iip].lnum = lnum;
255 c->lpt_lnum = lnum;
267 upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
269 err = alloc_lpt_leb(c, &lnum);
273 ubifs_assert(c, lnum >= c->lpt_first &&
274 lnum <= c->lpt_last);
277 c->lsave_lnum = lnum;
287 upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
289 err = alloc_lpt_leb(c, &lnum);
293 ubifs_assert(c, lnum >= c->lpt_first &&
294 lnum <= c->lpt_last);
296 c->ltab_lnum = lnum;
303 upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
312 lnum, offs, len, done_ltab, done_lsave);
322 * @lnum: LEB number is passed and returned here
329 * function starting from @lnum. If a LEB is found it is returned in @lnum and
333 static int realloc_lpt_leb(struct ubifs_info *c, int *lnum)
337 n = *lnum - c->lpt_first + 1;
341 *lnum = i + c->lpt_first;
348 *lnum = i + c->lpt_first;
362 int lnum, offs, len, from, err, wlen, alen, done_ltab, done_lsave;
369 lnum = c->nhead_lnum;
374 err = ubifs_leb_unmap(c, lnum);
406 err = ubifs_leb_write(c, lnum, buf + from, from,
412 err = realloc_lpt_leb(c, &lnum);
416 ubifs_assert(c, lnum >= c->lpt_first &&
417 lnum <= c->lpt_last);
418 err = ubifs_leb_unmap(c, lnum);
465 err = ubifs_leb_write(c, lnum, buf + from, from, alen);
469 err = realloc_lpt_leb(c, &lnum);
473 ubifs_assert(c, lnum >= c->lpt_first &&
474 lnum <= c->lpt_last);
475 err = ubifs_leb_unmap(c, lnum);
491 err = ubifs_leb_write(c, lnum, buf + from, from, alen);
495 err = realloc_lpt_leb(c, &lnum);
499 ubifs_assert(c, lnum >= c->lpt_first &&
500 lnum <= c->lpt_last);
501 err = ubifs_leb_unmap(c, lnum);
514 err = ubifs_leb_write(c, lnum, buf + from, from, alen);
523 c->nhead_lnum = lnum;
536 lnum, offs, len, done_ltab, done_lsave);
549 * pnodes. Note that pnodes that have never been written (lnum == 0) are
561 if (nnode->nbranch[iip].lnum)
572 if (nnode->nbranch[iip].lnum)
585 if (nnode->nbranch[iip].lnum)
601 if (nnode->nbranch[iip].lnum)
616 ubifs_add_lpt_dirt(c, pnode->parent->nbranch[pnode->iip].lnum,
777 c->lsave[cnt++] = lprops->lnum;
782 c->lsave[cnt++] = lprops->lnum;
787 c->lsave[cnt++] = lprops->lnum;
793 c->lsave[cnt++] = heap->arr[i]->lnum;
799 c->lsave[cnt++] = heap->arr[i]->lnum;
805 c->lsave[cnt++] = heap->arr[i]->lnum;
849 * @lnum: LEB number where nnode was written
860 static int make_nnode_dirty(struct ubifs_info *c, int node_num, int lnum,
872 if (branch->lnum != lnum || branch->offs != offs)
874 } else if (c->lpt_lnum != lnum || c->lpt_offs != offs)
898 * @lnum: LEB number where pnode was written
909 static int make_pnode_dirty(struct ubifs_info *c, int node_num, int lnum,
919 if (branch->lnum != lnum || branch->offs != offs)
928 * @lnum: LEB number where ltab was written
939 static int make_ltab_dirty(struct ubifs_info *c, int lnum, int offs)
941 if (lnum != c->ltab_lnum || offs != c->ltab_offs)
953 * @lnum: LEB number where lsave was written
964 static int make_lsave_dirty(struct ubifs_info *c, int lnum, int offs)
966 if (lnum != c->lsave_lnum || offs != c->lsave_offs)
980 * @lnum: LEB number where node was written
992 int lnum, int offs)
996 return make_nnode_dirty(c, node_num, lnum, offs);
998 return make_pnode_dirty(c, node_num, lnum, offs);
1000 return make_ltab_dirty(c, lnum, offs);
1002 return make_lsave_dirty(c, lnum, offs);
1096 * @lnum: LEB number to garbage collect
1105 static int lpt_gc_lnum(struct ubifs_info *c, int lnum)
1110 dbg_lp("LEB %d", lnum);
1112 err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1);
1133 err = make_node_dirty(c, node_type, node_num, lnum, offs);
1152 int i, lnum = -1, dirty = 0;
1162 lnum = i + c->lpt_first;
1166 if (lnum == -1)
1168 return lpt_gc_lnum(c, lnum);
1473 * @lnum: LEB number where nnode was written
1476 static int dbg_is_nnode_dirty(struct ubifs_info *c, int lnum, int offs)
1489 if (branch->lnum != lnum || branch->offs != offs)
1495 if (c->lpt_lnum != lnum || c->lpt_offs != offs)
1508 * @lnum: LEB number where pnode was written
1511 static int dbg_is_pnode_dirty(struct ubifs_info *c, int lnum, int offs)
1525 if (branch->lnum != lnum || branch->offs != offs)
1537 * @lnum: LEB number where ltab node was written
1540 static int dbg_is_ltab_dirty(struct ubifs_info *c, int lnum, int offs)
1542 if (lnum != c->ltab_lnum || offs != c->ltab_offs)
1550 * @lnum: LEB number where lsave node was written
1553 static int dbg_is_lsave_dirty(struct ubifs_info *c, int lnum, int offs)
1555 if (lnum != c->lsave_lnum || offs != c->lsave_offs)
1564 * @lnum: LEB number where node was written
1567 static int dbg_is_node_dirty(struct ubifs_info *c, int node_type, int lnum,
1572 return dbg_is_nnode_dirty(c, lnum, offs);
1574 return dbg_is_pnode_dirty(c, lnum, offs);
1576 return dbg_is_ltab_dirty(c, lnum, offs);
1578 return dbg_is_lsave_dirty(c, lnum, offs);
1586 * @lnum: LEB number where node was written
1590 static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum)
1605 dbg_lp("LEB %d", lnum);
1607 err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1);
1624 lnum, c->leb_size - len);
1627 i = lnum - c->lpt_first;
1630 lnum, len, c->ltab[i].free);
1635 lnum, dirty, c->ltab[i].dirty);
1642 ret = dbg_is_node_dirty(c, node_type, lnum, c->leb_size - len);
1663 int lnum, err, i, cnt;
1685 for (lnum = c->lpt_first; lnum <= c->lpt_last; lnum++) {
1686 err = dbg_check_ltab_lnum(c, lnum);
1688 ubifs_err(c, "failed at LEB %d", lnum);
1835 * @lnum: LEB number to dump
1842 static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
1847 pr_err("(pid %d) start dumping LEB %d\n", current->pid, lnum);
1854 err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1);
1866 lnum, offs, pad_len);
1873 lnum, offs, len);
1884 lnum, offs, node_num);
1886 pr_err("LEB %d:%d, pnode\n", lnum, offs);
1897 lnum, offs, node_num);
1900 lnum, offs);
1908 pr_cont("%d:%d", nnode.nbranch[i].lnum,
1918 pr_err("LEB %d:%d, ltab\n", lnum, offs);
1922 pr_err("LEB %d:%d, lsave len\n", lnum, offs);
1933 pr_err("(pid %d) finish dumping LEB %d\n", current->pid, lnum);
1980 c->lsave[prandom_u32() % c->lsave_cnt] = lprops->lnum;
1982 c->lsave[prandom_u32() % c->lsave_cnt] = lprops->lnum;
1984 c->lsave[prandom_u32() % c->lsave_cnt] = lprops->lnum;
1988 c->lsave[prandom_u32() % c->lsave_cnt] = heap->arr[i]->lnum;
1991 c->lsave[prandom_u32() % c->lsave_cnt] = heap->arr[i]->lnum;
1994 c->lsave[prandom_u32() % c->lsave_cnt] = heap->arr[i]->lnum;