Lines Matching refs:nnode
374 struct ubifs_nnode *nnode) in ubifs_pack_nnode() argument
382 pack_bits(c, &addr, &pos, nnode->num, c->pcnt_bits); in ubifs_pack_nnode()
384 int lnum = nnode->nbranch[i].lnum; in ubifs_pack_nnode()
389 pack_bits(c, &addr, &pos, nnode->nbranch[i].offs, in ubifs_pack_nnode()
484 void ubifs_add_nnode_dirt(struct ubifs_info *c, struct ubifs_nnode *nnode) in ubifs_add_nnode_dirt() argument
486 struct ubifs_nnode *np = nnode->parent; in ubifs_add_nnode_dirt()
489 ubifs_add_lpt_dirt(c, np->nbranch[nnode->iip].lnum, in ubifs_add_nnode_dirt()
605 struct ubifs_nnode *nnode = NULL; in ubifs_create_dflt_lpt() local
629 nnode = kzalloc(sizeof(struct ubifs_nnode), GFP_KERNEL); in ubifs_create_dflt_lpt()
633 if (!pnode || !nnode || !buf || !ltab || !lsave) { in ubifs_create_dflt_lpt()
757 nnode->nbranch[j].lnum = blnum; in ubifs_create_dflt_lpt()
758 nnode->nbranch[j].offs = boffs; in ubifs_create_dflt_lpt()
762 nnode->nbranch[j].lnum = 0; in ubifs_create_dflt_lpt()
763 nnode->nbranch[j].offs = 0; in ubifs_create_dflt_lpt()
766 nnode->num = calc_nnode_num(row, i); in ubifs_create_dflt_lpt()
767 ubifs_pack_nnode(c, p, nnode); in ubifs_create_dflt_lpt()
866 kfree(nnode); in ubifs_create_dflt_lpt()
1012 struct ubifs_nnode *nnode) in ubifs_unpack_nnode() argument
1021 nnode->num = ubifs_unpack_bits(c, &addr, &pos, c->pcnt_bits); in ubifs_unpack_nnode()
1029 nnode->nbranch[i].lnum = lnum; in ubifs_unpack_nnode()
1030 nnode->nbranch[i].offs = ubifs_unpack_bits(c, &addr, &pos, in ubifs_unpack_nnode()
1104 static int validate_nnode(const struct ubifs_info *c, struct ubifs_nnode *nnode, in validate_nnode() argument
1112 if (nnode->num != num) in validate_nnode()
1123 int lnum = nnode->nbranch[i].lnum; in validate_nnode()
1124 int offs = nnode->nbranch[i].offs; in validate_nnode()
1206 struct ubifs_nnode *nnode = NULL; in ubifs_read_nnode() local
1218 nnode = kzalloc(sizeof(struct ubifs_nnode), GFP_NOFS); in ubifs_read_nnode()
1219 if (!nnode) { in ubifs_read_nnode()
1231 nnode->num = calc_nnode_num_from_parent(c, parent, iip); in ubifs_read_nnode()
1236 err = ubifs_unpack_nnode(c, buf, nnode); in ubifs_read_nnode()
1240 err = validate_nnode(c, nnode, parent, iip); in ubifs_read_nnode()
1244 nnode->num = calc_nnode_num_from_parent(c, parent, iip); in ubifs_read_nnode()
1246 branch->nnode = nnode; in ubifs_read_nnode()
1247 nnode->level = parent->level - 1; in ubifs_read_nnode()
1249 c->nroot = nnode; in ubifs_read_nnode()
1250 nnode->level = c->lpt_hght; in ubifs_read_nnode()
1252 nnode->parent = parent; in ubifs_read_nnode()
1253 nnode->iip = iip; in ubifs_read_nnode()
1259 kfree(nnode); in ubifs_read_nnode()
1408 struct ubifs_nnode *nnode; in ubifs_get_nnode() local
1412 nnode = branch->nnode; in ubifs_get_nnode()
1413 if (nnode) in ubifs_get_nnode()
1414 return nnode; in ubifs_get_nnode()
1418 return branch->nnode; in ubifs_get_nnode()
1459 struct ubifs_nnode *nnode; in ubifs_pnode_lookup() local
1467 nnode = c->nroot; in ubifs_pnode_lookup()
1472 nnode = ubifs_get_nnode(c, nnode, iip); in ubifs_pnode_lookup()
1473 if (IS_ERR(nnode)) in ubifs_pnode_lookup()
1474 return ERR_CAST(nnode); in ubifs_pnode_lookup()
1477 return ubifs_get_pnode(c, nnode, iip); in ubifs_pnode_lookup()
1512 struct ubifs_nnode *nnode) in dirty_cow_nnode() argument
1517 if (!test_bit(COW_CNODE, &nnode->flags)) { in dirty_cow_nnode()
1519 if (!test_and_set_bit(DIRTY_CNODE, &nnode->flags)) { in dirty_cow_nnode()
1521 ubifs_add_nnode_dirt(c, nnode); in dirty_cow_nnode()
1523 return nnode; in dirty_cow_nnode()
1527 n = kmemdup(nnode, sizeof(struct ubifs_nnode), GFP_NOFS); in dirty_cow_nnode()
1543 ubifs_assert(c, !test_bit(OBSOLETE_CNODE, &nnode->flags)); in dirty_cow_nnode()
1544 __set_bit(OBSOLETE_CNODE, &nnode->flags); in dirty_cow_nnode()
1547 ubifs_add_nnode_dirt(c, nnode); in dirty_cow_nnode()
1548 if (nnode->parent) in dirty_cow_nnode()
1549 nnode->parent->nbranch[n->iip].nnode = n; in dirty_cow_nnode()
1606 struct ubifs_nnode *nnode; in ubifs_lpt_lookup_dirty() local
1614 nnode = c->nroot; in ubifs_lpt_lookup_dirty()
1615 nnode = dirty_cow_nnode(c, nnode); in ubifs_lpt_lookup_dirty()
1616 if (IS_ERR(nnode)) in ubifs_lpt_lookup_dirty()
1617 return ERR_CAST(nnode); in ubifs_lpt_lookup_dirty()
1623 nnode = ubifs_get_nnode(c, nnode, iip); in ubifs_lpt_lookup_dirty()
1624 if (IS_ERR(nnode)) in ubifs_lpt_lookup_dirty()
1625 return ERR_CAST(nnode); in ubifs_lpt_lookup_dirty()
1626 nnode = dirty_cow_nnode(c, nnode); in ubifs_lpt_lookup_dirty()
1627 if (IS_ERR(nnode)) in ubifs_lpt_lookup_dirty()
1628 return ERR_CAST(nnode); in ubifs_lpt_lookup_dirty()
1631 pnode = ubifs_get_pnode(c, nnode, iip); in ubifs_lpt_lookup_dirty()
1655 struct ubifs_nnode *nnode, *nn; in ubifs_lpt_calc_hash() local
1685 nnode = cnode->parent; in ubifs_lpt_calc_hash()
1695 nnode = ubifs_get_nnode(c, nn, iip); in ubifs_lpt_calc_hash()
1696 if (IS_ERR(nnode)) { in ubifs_lpt_calc_hash()
1697 err = PTR_ERR(nnode); in ubifs_lpt_calc_hash()
1703 cnode = (struct ubifs_cnode *)nnode; in ubifs_lpt_calc_hash()
1729 cnode = (struct ubifs_cnode *)nnode; in ubifs_lpt_calc_hash()
1928 struct ubifs_nnode nnode; member
1934 struct ubifs_nnode *nnode; member
1955 struct ubifs_nnode *nnode; in scan_get_nnode() local
1960 nnode = branch->nnode; in scan_get_nnode()
1961 if (nnode) { in scan_get_nnode()
1963 path->ptr.nnode = nnode; in scan_get_nnode()
1964 return nnode; in scan_get_nnode()
1966 nnode = &path->nnode; in scan_get_nnode()
1968 path->ptr.nnode = nnode; in scan_get_nnode()
1969 memset(nnode, 0, sizeof(struct ubifs_nnode)); in scan_get_nnode()
1978 nnode->num = calc_nnode_num_from_parent(c, parent, iip); in scan_get_nnode()
1984 err = ubifs_unpack_nnode(c, buf, nnode); in scan_get_nnode()
1988 err = validate_nnode(c, nnode, parent, iip); in scan_get_nnode()
1992 nnode->num = calc_nnode_num_from_parent(c, parent, iip); in scan_get_nnode()
1993 nnode->level = parent->level - 1; in scan_get_nnode()
1994 nnode->parent = parent; in scan_get_nnode()
1995 nnode->iip = iip; in scan_get_nnode()
1996 return nnode; in scan_get_nnode()
2082 struct ubifs_nnode *nnode; in ubifs_lpt_scan_nolock() local
2106 path[0].ptr.nnode = c->nroot; in ubifs_lpt_scan_nolock()
2110 nnode = c->nroot; in ubifs_lpt_scan_nolock()
2116 nnode = scan_get_nnode(c, path + h, nnode, iip); in ubifs_lpt_scan_nolock()
2117 if (IS_ERR(nnode)) { in ubifs_lpt_scan_nolock()
2118 err = PTR_ERR(nnode); in ubifs_lpt_scan_nolock()
2123 pnode = scan_get_pnode(c, path + h, nnode, iip); in ubifs_lpt_scan_nolock()
2148 nnode = kmemdup(&path[h].nnode, sz, GFP_NOFS); in ubifs_lpt_scan_nolock()
2149 if (!nnode) { in ubifs_lpt_scan_nolock()
2153 parent = nnode->parent; in ubifs_lpt_scan_nolock()
2154 parent->nbranch[nnode->iip].nnode = nnode; in ubifs_lpt_scan_nolock()
2155 path[h].ptr.nnode = nnode; in ubifs_lpt_scan_nolock()
2157 path[h + 1].cnode.parent = nnode; in ubifs_lpt_scan_nolock()
2213 nnode = path[h].ptr.nnode; in ubifs_lpt_scan_nolock()
2216 iip = nnode->iip; in ubifs_lpt_scan_nolock()
2223 nnode = scan_get_nnode(c, path + h, nnode, iip); in ubifs_lpt_scan_nolock()
2224 if (IS_ERR(nnode)) { in ubifs_lpt_scan_nolock()
2225 err = PTR_ERR(nnode); in ubifs_lpt_scan_nolock()
2230 pnode = scan_get_pnode(c, path + h, nnode, iip); in ubifs_lpt_scan_nolock()
2383 struct ubifs_nnode *nnode, *nn; in dbg_check_lpt_nodes() local
2392 nnode = cnode->parent; in dbg_check_lpt_nodes()
2399 (nnode ? nnode->num : 0), cnode->iip); in dbg_check_lpt_nodes()
2432 cnode = (struct ubifs_cnode *)nnode; in dbg_check_lpt_nodes()