Lines Matching refs:znode
870 const struct ubifs_znode *znode)
877 if (znode->parent)
878 zbr = &znode->parent->zbranch[znode->iip];
882 pr_err("znode %p, LEB %d:%d len %d parent %p iip %d level %d child_cnt %d flags %lx\n",
883 znode, zbr->lnum, zbr->offs, zbr->len, znode->parent, znode->iip,
884 znode->level, znode->child_cnt, znode->flags);
886 if (znode->child_cnt <= 0 || znode->child_cnt > c->fanout) {
892 for (n = 0; n < znode->child_cnt; n++) {
893 zbr = &znode->zbranch[n];
894 if (znode->level > 0)
895 pr_err("\t%d: znode %p LEB %d:%d len %d key %s\n",
896 n, zbr->znode, zbr->lnum, zbr->offs, zbr->len,
901 n, zbr->znode, zbr->lnum, zbr->offs, zbr->len,
944 struct ubifs_znode *znode;
949 znode = ubifs_tnc_levelorder_next(c, c->zroot.znode, NULL);
950 level = znode->level;
952 while (znode) {
953 if (level != znode->level) {
954 level = znode->level;
957 ubifs_dump_znode(c, znode);
958 znode = ubifs_tnc_levelorder_next(c, c->zroot.znode, znode);
963 static int dump_znode(struct ubifs_info *c, struct ubifs_znode *znode,
966 ubifs_dump_znode(c, znode);
1278 * dbg_check_znode - check if znode is all right.
1280 * @zbr: zbranch which points to this znode
1282 * This function makes sure that znode referred to by @zbr is all right.
1287 struct ubifs_znode *znode = zbr->znode;
1288 struct ubifs_znode *zp = znode->parent;
1291 if (znode->child_cnt <= 0 || znode->child_cnt > c->fanout) {
1295 if (znode->level < 0) {
1299 if (znode->iip < 0 || znode->iip >= c->fanout) {
1306 if (!ubifs_zn_dirty(znode)) {
1311 if (ubifs_zn_dirty(znode)) {
1313 * If znode is dirty, its parent has to be dirty as well. The
1321 * TNC mutex, so znode's dirty flag may now have
1326 if (ubifs_zn_dirty(znode)) {
1336 if (znode->level != zp->level - 1) {
1341 /* Make sure the 'parent' pointer in our znode is correct */
1349 if (znode->iip >= zp->child_cnt) {
1354 if (znode->iip != n) {
1357 &zp->zbranch[znode->iip].key)) {
1361 n = znode->iip;
1365 * Make sure that the first key in our znode is greater than or
1369 cmp = keys_cmp(c, min, &znode->zbranch[0].key);
1379 * Make sure the last key in our znode is less or
1384 &znode->zbranch[znode->child_cnt - 1].key);
1391 /* This may only be root znode */
1402 for (n = 1; n < znode->child_cnt; n++) {
1403 cmp = keys_cmp(c, &znode->zbranch[n - 1].key,
1404 &znode->zbranch[n].key);
1411 if (!is_hash_key(c, &znode->zbranch[n].key)) {
1416 if (znode->level != 0 || c->replaying)
1423 err = dbg_check_key_order(c, &znode->zbranch[n - 1],
1424 &znode->zbranch[n]);
1434 for (n = 0; n < znode->child_cnt; n++) {
1435 if (!znode->zbranch[n].znode &&
1436 (znode->zbranch[n].lnum == 0 ||
1437 znode->zbranch[n].len == 0)) {
1442 if (znode->zbranch[n].lnum != 0 &&
1443 znode->zbranch[n].len == 0) {
1448 if (znode->zbranch[n].lnum == 0 &&
1449 znode->zbranch[n].len != 0) {
1454 if (znode->zbranch[n].lnum == 0 &&
1455 znode->zbranch[n].offs != 0) {
1460 if (znode->level != 0 && znode->zbranch[n].znode)
1461 if (znode->zbranch[n].znode->parent != znode) {
1471 ubifs_msg(c, "dump of the znode");
1472 ubifs_dump_znode(c, znode);
1474 ubifs_msg(c, "dump of the parent znode");
1486 * This function traverses whole TNC tree and checks every znode. Returns zero
1491 struct ubifs_znode *znode;
1499 if (!c->zroot.znode)
1502 znode = ubifs_tnc_postorder_first(c->zroot.znode);
1507 if (!znode->parent)
1510 zbr = &znode->parent->zbranch[znode->iip];
1517 if (ubifs_zn_dirty(znode))
1523 prev = znode;
1524 znode = ubifs_tnc_postorder_next(c, znode);
1525 if (!znode)
1529 * If the last key of this znode is equivalent to the first key
1530 * of the next znode (collision), then check order of the keys.
1533 if (prev->level == 0 && znode->level == 0 && !c->replaying &&
1535 &znode->zbranch[0].key)) {
1537 &znode->zbranch[0]);
1541 ubifs_msg(c, "first znode");
1543 ubifs_msg(c, "second znode");
1544 ubifs_dump_znode(c, znode);
1579 * It would be better if this function removed every znode it pulled to into
1588 struct ubifs_znode *znode, *child;
1592 if (!c->zroot.znode) {
1593 c->zroot.znode = ubifs_load_znode(c, &c->zroot, NULL, 0);
1594 if (IS_ERR(c->zroot.znode)) {
1595 err = PTR_ERR(c->zroot.znode);
1596 c->zroot.znode = NULL;
1606 znode = c->zroot.znode;
1607 while (znode->level > 0) {
1608 zbr = &znode->zbranch[0];
1609 child = zbr->znode;
1611 child = ubifs_load_znode(c, zbr, znode, 0);
1618 znode = child;
1628 err = znode_cb(c, znode, priv);
1630 ubifs_err(c, "znode checking function returned error %d",
1632 ubifs_dump_znode(c, znode);
1636 if (leaf_cb && znode->level == 0) {
1637 for (idx = 0; idx < znode->child_cnt; idx++) {
1638 zbr = &znode->zbranch[idx];
1648 if (!znode->parent)
1651 idx = znode->iip + 1;
1652 znode = znode->parent;
1653 if (idx < znode->child_cnt) {
1655 zbr = &znode->zbranch[idx];
1656 child = zbr->znode;
1658 child = ubifs_load_znode(c, zbr, znode, idx);
1663 zbr->znode = child;
1665 znode = child;
1673 /* Go to the lowest leftmost znode in the new sub-tree */
1674 while (znode->level > 0) {
1675 zbr = &znode->zbranch[0];
1676 child = zbr->znode;
1678 child = ubifs_load_znode(c, zbr, znode, 0);
1683 zbr->znode = child;
1685 znode = child;
1693 if (znode->parent)
1694 zbr = &znode->parent->zbranch[znode->iip];
1697 ubifs_msg(c, "dump of znode at LEB %d:%d", zbr->lnum, zbr->offs);
1698 ubifs_dump_znode(c, znode);
1705 * add_size - add znode size to partially calculated index size.
1707 * @znode: znode to add size for
1714 static int add_size(struct ubifs_info *c, struct ubifs_znode *znode, void *priv)
1719 add = ubifs_idx_node_sz(c, znode->child_cnt);
1936 struct ubifs_znode *znode;
1946 err = ubifs_lookup_level0(c, &key, &znode, &n);
1956 zbr = &znode->zbranch[n];
2171 struct ubifs_znode *znode;
2246 err = ubifs_lookup_level0(c, &key, &znode, &n);
2257 zbr = &znode->zbranch[n];