Lines Matching defs:lnum

136  * @lnum: LEB number
140 static void upd_ltab(struct ubifs_info *c, int lnum, int free, int dirty)
143 lnum, c->ltab[lnum - c->lpt_first].free,
144 c->ltab[lnum - c->lpt_first].dirty, free, dirty);
145 ubifs_assert(lnum >= c->lpt_first && lnum <= c->lpt_last);
146 c->ltab[lnum - c->lpt_first].free = free;
147 c->ltab[lnum - c->lpt_first].dirty += dirty;
153 * @lnum: LEB number is passed and returned here
155 * This function finds the next empty LEB in the ltab starting from @lnum. If a
156 * an empty LEB is found it is returned in @lnum and the function returns %0.
160 static int alloc_lpt_leb(struct ubifs_info *c, int *lnum)
164 n = *lnum - c->lpt_first + 1;
170 *lnum = i + c->lpt_first;
180 *lnum = i + c->lpt_first;
195 int lnum, offs, len, alen, done_lsave, done_ltab, err;
204 lnum = c->nhead_lnum;
211 c->lsave_lnum = lnum;
219 c->ltab_lnum = lnum;
235 upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
237 err = alloc_lpt_leb(c, &lnum);
241 ubifs_assert(lnum >= c->lpt_first &&
242 lnum <= c->lpt_last);
246 c->lsave_lnum = lnum;
254 c->ltab_lnum = lnum;
263 cnode->parent->nbranch[cnode->iip].lnum = lnum;
266 c->lpt_lnum = lnum;
278 upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
280 err = alloc_lpt_leb(c, &lnum);
284 ubifs_assert(lnum >= c->lpt_first &&
285 lnum <= c->lpt_last);
288 c->lsave_lnum = lnum;
298 upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
300 err = alloc_lpt_leb(c, &lnum);
304 ubifs_assert(lnum >= c->lpt_first &&
305 lnum <= c->lpt_last);
307 c->ltab_lnum = lnum;
314 upd_ltab(c, lnum, c->leb_size - alen, alen - offs);
323 lnum, offs, len, done_ltab, done_lsave);
334 * @lnum: LEB number is passed and returned here
341 * function starting from @lnum. If a LEB is found it is returned in @lnum and
345 static int realloc_lpt_leb(struct ubifs_info *c, int *lnum)
349 n = *lnum - c->lpt_first + 1;
353 *lnum = i + c->lpt_first;
360 *lnum = i + c->lpt_first;
374 int lnum, offs, len, from, err, wlen, alen, done_ltab, done_lsave;
381 lnum = c->nhead_lnum;
386 err = ubifs_leb_unmap(c, lnum);
418 err = ubifs_leb_write(c, lnum, buf + from, from,
424 err = realloc_lpt_leb(c, &lnum);
428 ubifs_assert(lnum >= c->lpt_first &&
429 lnum <= c->lpt_last);
430 err = ubifs_leb_unmap(c, lnum);
477 err = ubifs_leb_write(c, lnum, buf + from, from, alen);
481 err = realloc_lpt_leb(c, &lnum);
485 ubifs_assert(lnum >= c->lpt_first &&
486 lnum <= c->lpt_last);
487 err = ubifs_leb_unmap(c, lnum);
503 err = ubifs_leb_write(c, lnum, buf + from, from, alen);
507 err = realloc_lpt_leb(c, &lnum);
511 ubifs_assert(lnum >= c->lpt_first &&
512 lnum <= c->lpt_last);
513 err = ubifs_leb_unmap(c, lnum);
526 err = ubifs_leb_write(c, lnum, buf + from, from, alen);
535 c->nhead_lnum = lnum;
548 lnum, offs, len, done_ltab, done_lsave);
562 * pnodes. Note that pnodes that have never been written (lnum == 0) are
574 if (nnode->nbranch[iip].lnum)
585 if (nnode->nbranch[iip].lnum)
598 if (nnode->nbranch[iip].lnum)
614 if (nnode->nbranch[iip].lnum)
661 ubifs_add_lpt_dirt(c, pnode->parent->nbranch[pnode->iip].lnum,
824 c->lsave[cnt++] = lprops->lnum;
829 c->lsave[cnt++] = lprops->lnum;
834 c->lsave[cnt++] = lprops->lnum;
840 c->lsave[cnt++] = heap->arr[i]->lnum;
846 c->lsave[cnt++] = heap->arr[i]->lnum;
852 c->lsave[cnt++] = heap->arr[i]->lnum;
896 * @lnum: LEB number where nnode was written
907 static int make_nnode_dirty(struct ubifs_info *c, int node_num, int lnum,
919 if (branch->lnum != lnum || branch->offs != offs)
921 } else if (c->lpt_lnum != lnum || c->lpt_offs != offs)
945 * @lnum: LEB number where pnode was written
956 static int make_pnode_dirty(struct ubifs_info *c, int node_num, int lnum,
966 if (branch->lnum != lnum || branch->offs != offs)
975 * @lnum: LEB number where ltab was written
986 static int make_ltab_dirty(struct ubifs_info *c, int lnum, int offs)
988 if (lnum != c->ltab_lnum || offs != c->ltab_offs)
1000 * @lnum: LEB number where lsave was written
1011 static int make_lsave_dirty(struct ubifs_info *c, int lnum, int offs)
1013 if (lnum != c->lsave_lnum || offs != c->lsave_offs)
1027 * @lnum: LEB number where node was written
1039 int lnum, int offs)
1043 return make_nnode_dirty(c, node_num, lnum, offs);
1045 return make_pnode_dirty(c, node_num, lnum, offs);
1047 return make_ltab_dirty(c, lnum, offs);
1049 return make_lsave_dirty(c, lnum, offs);
1143 * @lnum: LEB number to garbage collect
1152 static int lpt_gc_lnum(struct ubifs_info *c, int lnum)
1157 dbg_lp("LEB %d", lnum);
1159 err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1);
1180 err = make_node_dirty(c, node_type, node_num, lnum, offs);
1199 int i, lnum = -1, dirty = 0;
1209 lnum = i + c->lpt_first;
1213 if (lnum == -1)
1215 return lpt_gc_lnum(c, lnum);
1519 * @lnum: LEB number where nnode was written
1522 static int dbg_is_nnode_dirty(struct ubifs_info *c, int lnum, int offs)
1535 if (branch->lnum != lnum || branch->offs != offs)
1541 if (c->lpt_lnum != lnum || c->lpt_offs != offs)
1554 * @lnum: LEB number where pnode was written
1557 static int dbg_is_pnode_dirty(struct ubifs_info *c, int lnum, int offs)
1571 if (branch->lnum != lnum || branch->offs != offs)
1583 * @lnum: LEB number where ltab node was written
1586 static int dbg_is_ltab_dirty(struct ubifs_info *c, int lnum, int offs)
1588 if (lnum != c->ltab_lnum || offs != c->ltab_offs)
1596 * @lnum: LEB number where lsave node was written
1599 static int dbg_is_lsave_dirty(struct ubifs_info *c, int lnum, int offs)
1601 if (lnum != c->lsave_lnum || offs != c->lsave_offs)
1610 * @lnum: LEB number where node was written
1613 static int dbg_is_node_dirty(struct ubifs_info *c, int node_type, int lnum,
1618 return dbg_is_nnode_dirty(c, lnum, offs);
1620 return dbg_is_pnode_dirty(c, lnum, offs);
1622 return dbg_is_ltab_dirty(c, lnum, offs);
1624 return dbg_is_lsave_dirty(c, lnum, offs);
1632 * @lnum: LEB number where node was written
1637 static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum)
1652 dbg_lp("LEB %d", lnum);
1654 err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1);
1671 lnum, c->leb_size - len);
1674 i = lnum - c->lpt_first;
1677 lnum, len, c->ltab[i].free);
1682 lnum, dirty, c->ltab[i].dirty);
1689 ret = dbg_is_node_dirty(c, node_type, lnum, c->leb_size - len);
1710 int lnum, err, i, cnt;
1732 for (lnum = c->lpt_first; lnum <= c->lpt_last; lnum++) {
1733 err = dbg_check_ltab_lnum(c, lnum);
1735 ubifs_err(c, "failed at LEB %d", lnum);
1882 * @lnum: LEB number to dump
1889 static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
1894 pr_err("(pid %d) start dumping LEB %d\n", current->pid, lnum);
1901 err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1);
1913 lnum, offs, pad_len);
1920 lnum, offs, len);
1931 lnum, offs, node_num);
1933 pr_err("LEB %d:%d, pnode\n", lnum, offs);
1944 lnum, offs, node_num);
1947 lnum, offs);
1955 pr_cont("%d:%d", nnode.nbranch[i].lnum,
1965 pr_err("LEB %d:%d, ltab\n", lnum, offs);
1969 pr_err("LEB %d:%d, lsave len\n", lnum, offs);
1980 pr_err("(pid %d) finish dumping LEB %d\n", current->pid, lnum);
2027 c->lsave[prandom_u32() % c->lsave_cnt] = lprops->lnum;
2029 c->lsave[prandom_u32() % c->lsave_cnt] = lprops->lnum;
2031 c->lsave[prandom_u32() % c->lsave_cnt] = lprops->lnum;
2035 c->lsave[prandom_u32() % c->lsave_cnt] = heap->arr[i]->lnum;
2038 c->lsave[prandom_u32() % c->lsave_cnt] = heap->arr[i]->lnum;
2041 c->lsave[prandom_u32() % c->lsave_cnt] = heap->arr[i]->lnum;