• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/fs/ubifs/

Lines Matching refs:nnode

378  * ubifs_pack_nnode - pack all the bit fields of a nnode.
381 * @nnode: nnode to pack
384 struct ubifs_nnode *nnode)
392 pack_bits(&addr, &pos, nnode->num, c->pcnt_bits);
394 int lnum = nnode->nbranch[i].lnum;
399 pack_bits(&addr, &pos, nnode->nbranch[i].offs,
492 * @nnode: nnode for which to add dirt
494 void ubifs_add_nnode_dirt(struct ubifs_info *c, struct ubifs_nnode *nnode)
496 struct ubifs_nnode *np = nnode->parent;
499 ubifs_add_lpt_dirt(c, np->nbranch[nnode->iip].lnum,
522 * calc_nnode_num - calculate nnode number.
526 * The nnode number is a number that uniquely identifies a nnode and can be used
527 * easily to traverse the tree from the root to that nnode.
529 * This function calculates and returns the nnode number for the nnode at @row
547 * calc_nnode_num_from_parent - calculate nnode number.
549 * @parent: parent nnode
552 * The nnode number is a number that uniquely identifies a nnode and can be used
553 * easily to traverse the tree from the root to that nnode.
555 * This function calculates and returns the nnode number based on the parent's
556 * nnode number and the index in parent.
574 * @parent: parent nnode
581 * nnode number and the index in parent.
614 struct ubifs_nnode *nnode = NULL;
633 nnode = kzalloc(sizeof(struct ubifs_nnode), GFP_KERNEL);
636 if (!pnode || !nnode || !buf || !ltab || !lsave) {
742 /* Only 1 nnode at this level, so it is the root */
754 nnode->nbranch[j].lnum = blnum;
755 nnode->nbranch[j].offs = boffs;
759 nnode->nbranch[j].lnum = 0;
760 nnode->nbranch[j].offs = 0;
763 nnode->num = calc_nnode_num(row, i);
764 ubifs_pack_nnode(c, p, nnode);
768 /* Only 1 nnode at this level, so it is the root */
859 kfree(nnode);
996 * ubifs_unpack_nnode - unpack a nnode.
998 * @buf: buffer containing packed nnode to unpack
999 * @nnode: nnode structure to fill
1004 struct ubifs_nnode *nnode)
1013 nnode->num = ubifs_unpack_bits(&addr, &pos, c->pcnt_bits);
1021 nnode->nbranch[i].lnum = lnum;
1022 nnode->nbranch[i].offs = ubifs_unpack_bits(&addr, &pos,
1088 * validate_nnode - validate a nnode.
1090 * @nnode: nnode to validate
1091 * @parent: parent nnode (or NULL for the root nnode)
1096 static int validate_nnode(const struct ubifs_info *c, struct ubifs_nnode *nnode,
1104 if (nnode->num != num)
1115 int lnum = nnode->nbranch[i].lnum;
1116 int offs = nnode->nbranch[i].offs;
1135 * @parent: parent nnode
1188 * ubifs_read_nnode - read a nnode from flash and link it to the tree in memory.
1190 * @parent: parent nnode (or NULL for the root)
1198 struct ubifs_nnode *nnode = NULL;
1210 nnode = kzalloc(sizeof(struct ubifs_nnode), GFP_NOFS);
1211 if (!nnode) {
1217 * This nnode was not written which just means that the LEB
1219 * make the nnode as though we had read it, which in fact means
1223 nnode->num = calc_nnode_num_from_parent(c, parent, iip);
1228 err = ubifs_unpack_nnode(c, buf, nnode);
1232 err = validate_nnode(c, nnode, parent, iip);
1236 nnode->num = calc_nnode_num_from_parent(c, parent, iip);
1238 branch->nnode = nnode;
1239 nnode->level = parent->level - 1;
1241 c->nroot = nnode;
1242 nnode->level = c->lpt_hght;
1244 nnode->parent = parent;
1245 nnode->iip = iip;
1249 ubifs_err("error %d reading nnode at %d:%d", err, lnum, offs);
1250 kfree(nnode);
1257 * @parent: parent nnode
1381 * ubifs_get_nnode - get a nnode.
1383 * @parent: parent nnode (or NULL for the root)
1386 * This function returns a pointer to the nnode on success or a negative error
1393 struct ubifs_nnode *nnode;
1397 nnode = branch->nnode;
1398 if (nnode)
1399 return nnode;
1403 return branch->nnode;
1409 * @parent: parent nnode
1444 struct ubifs_nnode *nnode;
1452 nnode = c->nroot;
1458 nnode = ubifs_get_nnode(c, nnode, iip);
1459 if (IS_ERR(nnode))
1460 return ERR_CAST(nnode);
1464 pnode = ubifs_get_pnode(c, nnode, iip);
1475 * dirty_cow_nnode - ensure a nnode is not being committed.
1477 * @nnode: nnode to check
1479 * Returns dirtied nnode on success or negative error code on failure.
1482 struct ubifs_nnode *nnode)
1487 if (!test_bit(COW_CNODE, &nnode->flags)) {
1488 /* nnode is not being committed */
1489 if (!test_and_set_bit(DIRTY_CNODE, &nnode->flags)) {
1491 ubifs_add_nnode_dirt(c, nnode);
1493 return nnode;
1496 /* nnode is being committed, so copy it */
1501 memcpy(n, nnode, sizeof(struct ubifs_nnode));
1514 ubifs_assert(!test_bit(OBSOLETE_CNODE, &nnode->flags));
1515 __set_bit(OBSOLETE_CNODE, &nnode->flags);
1518 ubifs_add_nnode_dirt(c, nnode);
1519 if (nnode->parent)
1520 nnode->parent->nbranch[n->iip].nnode = n;
1578 struct ubifs_nnode *nnode;
1586 nnode = c->nroot;
1587 nnode = dirty_cow_nnode(c, nnode);
1588 if (IS_ERR(nnode))
1589 return ERR_CAST(nnode);
1595 nnode = ubifs_get_nnode(c, nnode, iip);
1596 if (IS_ERR(nnode))
1597 return ERR_CAST(nnode);
1598 nnode = dirty_cow_nnode(c, nnode);
1599 if (IS_ERR(nnode))
1600 return ERR_CAST(nnode);
1604 pnode = ubifs_get_pnode(c, nnode, iip);
1750 * @nnode: where to keep a nnode
1754 * @ptr.nnode: pointer to the nnode (if it is an nnode) which may be here or in
1761 struct ubifs_nnode nnode;
1767 struct ubifs_nnode *nnode;
1774 * scan_get_nnode - for the scan, get a nnode from either the tree or flash.
1776 * @path: where to put the nnode
1777 * @parent: parent of the nnode
1778 * @iip: index in parent of the nnode
1780 * This function returns a pointer to the nnode on success or a negative error
1788 struct ubifs_nnode *nnode;
1793 nnode = branch->nnode;
1794 if (nnode) {
1796 path->ptr.nnode = nnode;
1797 return nnode;
1799 nnode = &path->nnode;
1801 path->ptr.nnode = nnode;
1802 memset(nnode, 0, sizeof(struct ubifs_nnode));
1805 * This nnode was not written which just means that the LEB
1807 * make the nnode as though we had read it, which in fact means
1811 nnode->num = calc_nnode_num_from_parent(c, parent, iip);
1817 err = ubifs_unpack_nnode(c, buf, nnode);
1821 err = validate_nnode(c, nnode, parent, iip);
1825 nnode->num = calc_nnode_num_from_parent(c, parent, iip);
1826 nnode->level = parent->level - 1;
1827 nnode->parent = parent;
1828 nnode->iip = iip;
1829 return nnode;
1915 struct ubifs_nnode *nnode;
1939 path[0].ptr.nnode = c->nroot;
1943 nnode = c->nroot;
1949 nnode = scan_get_nnode(c, path + h, nnode, iip);
1950 if (IS_ERR(nnode)) {
1951 err = PTR_ERR(nnode);
1957 pnode = scan_get_pnode(c, path + h, nnode, iip);
1982 nnode = kmalloc(sz, GFP_NOFS);
1983 if (!nnode) {
1987 memcpy(nnode, &path[h].nnode, sz);
1988 parent = nnode->parent;
1989 parent->nbranch[nnode->iip].nnode = nnode;
1990 path[h].ptr.nnode = nnode;
1992 path[h + 1].cnode.parent = nnode;
2049 nnode = path[h].ptr.nnode;
2052 iip = nnode->iip;
2059 nnode = scan_get_nnode(c, path + h, nnode, iip);
2060 if (IS_ERR(nnode)) {
2061 err = PTR_ERR(nnode);
2066 pnode = scan_get_pnode(c, path + h, nnode, iip);
2210 * @cnode: next cnode (nnode or pnode) to check
2219 struct ubifs_nnode *nnode, *nn;
2228 nnode = cnode->parent;
2230 /* cnode is a nnode */
2233 dbg_err("nnode num %d expected %d "
2235 (nnode ? nnode->num : 0), cnode->iip);
2268 cnode = (struct ubifs_cnode *)nnode;