Lines Matching defs:znode
842 const struct ubifs_znode *znode)
848 if (znode->parent)
849 zbr = &znode->parent->zbranch[znode->iip];
853 printk(KERN_DEBUG "znode %p, LEB %d:%d len %d parent %p iip %d level %d"
854 " child_cnt %d flags %lx\n", znode, zbr->lnum, zbr->offs,
855 zbr->len, znode->parent, znode->iip, znode->level,
856 znode->child_cnt, znode->flags);
858 if (znode->child_cnt <= 0 || znode->child_cnt > c->fanout) {
864 for (n = 0; n < znode->child_cnt; n++) {
865 zbr = &znode->zbranch[n];
866 if (znode->level > 0)
867 printk(KERN_DEBUG "\t%d: znode %p LEB %d:%d len %d key "
868 "%s\n", n, zbr->znode, zbr->lnum,
873 "%s\n", n, zbr->znode, zbr->lnum,
916 struct ubifs_znode *znode;
921 znode = ubifs_tnc_levelorder_next(c->zroot.znode, NULL);
922 level = znode->level;
924 while (znode) {
925 if (level != znode->level) {
926 level = znode->level;
929 dbg_dump_znode(c, znode);
930 znode = ubifs_tnc_levelorder_next(c->zroot.znode, znode);
935 static int dump_znode(struct ubifs_info *c, struct ubifs_znode *znode,
938 dbg_dump_znode(c, znode);
1209 * dbg_check_znode - check if znode is all right.
1211 * @zbr: zbranch which points to this znode
1213 * This function makes sure that znode referred to by @zbr is all right.
1218 struct ubifs_znode *znode = zbr->znode;
1219 struct ubifs_znode *zp = znode->parent;
1222 if (znode->child_cnt <= 0 || znode->child_cnt > c->fanout) {
1226 if (znode->level < 0) {
1230 if (znode->iip < 0 || znode->iip >= c->fanout) {
1237 if (!ubifs_zn_dirty(znode)) {
1242 if (ubifs_zn_dirty(znode)) {
1244 * If znode is dirty, its parent has to be dirty as well. The
1252 * TNC mutex, so znode's dirty flag may now have
1257 if (ubifs_zn_dirty(znode)) {
1267 if (znode->level != zp->level - 1) {
1272 /* Make sure the 'parent' pointer in our znode is correct */
1280 if (znode->iip >= zp->child_cnt) {
1285 if (znode->iip != n) {
1288 &zp->zbranch[znode->iip].key)) {
1292 n = znode->iip;
1296 * Make sure that the first key in our znode is greater than or
1300 cmp = keys_cmp(c, min, &znode->zbranch[0].key);
1310 * Make sure the last key in our znode is less or
1315 &znode->zbranch[znode->child_cnt - 1].key);
1322 /* This may only be root znode */
1333 for (n = 1; n < znode->child_cnt; n++) {
1334 cmp = keys_cmp(c, &znode->zbranch[n - 1].key,
1335 &znode->zbranch[n].key);
1342 if (!is_hash_key(c, &znode->zbranch[n].key)) {
1347 if (znode->level != 0 || c->replaying)
1354 err = dbg_check_key_order(c, &znode->zbranch[n - 1],
1355 &znode->zbranch[n]);
1365 for (n = 0; n < znode->child_cnt; n++) {
1366 if (!znode->zbranch[n].znode &&
1367 (znode->zbranch[n].lnum == 0 ||
1368 znode->zbranch[n].len == 0)) {
1373 if (znode->zbranch[n].lnum != 0 &&
1374 znode->zbranch[n].len == 0) {
1379 if (znode->zbranch[n].lnum == 0 &&
1380 znode->zbranch[n].len != 0) {
1385 if (znode->zbranch[n].lnum == 0 &&
1386 znode->zbranch[n].offs != 0) {
1391 if (znode->level != 0 && znode->zbranch[n].znode)
1392 if (znode->zbranch[n].znode->parent != znode) {
1402 ubifs_msg("dump of the znode");
1403 dbg_dump_znode(c, znode);
1405 ubifs_msg("dump of the parent znode");
1417 * This function traverses whole TNC tree and checks every znode. Returns zero
1422 struct ubifs_znode *znode;
1430 if (!c->zroot.znode)
1433 znode = ubifs_tnc_postorder_first(c->zroot.znode);
1438 if (!znode->parent)
1441 zbr = &znode->parent->zbranch[znode->iip];
1448 if (ubifs_zn_dirty(znode))
1454 prev = znode;
1455 znode = ubifs_tnc_postorder_next(znode);
1456 if (!znode)
1460 * If the last key of this znode is equivalent to the first key
1461 * of the next znode (collision), then check order of the keys.
1464 if (prev->level == 0 && znode->level == 0 && !c->replaying &&
1466 &znode->zbranch[0].key)) {
1468 &znode->zbranch[0]);
1472 ubifs_msg("first znode");
1474 ubifs_msg("second znode");
1475 dbg_dump_znode(c, znode);
1510 * It would be better if this function removed every znode it pulled to into
1519 struct ubifs_znode *znode, *child;
1523 if (!c->zroot.znode) {
1524 c->zroot.znode = ubifs_load_znode(c, &c->zroot, NULL, 0);
1525 if (IS_ERR(c->zroot.znode)) {
1526 err = PTR_ERR(c->zroot.znode);
1527 c->zroot.znode = NULL;
1537 znode = c->zroot.znode;
1538 while (znode->level > 0) {
1539 zbr = &znode->zbranch[0];
1540 child = zbr->znode;
1542 child = ubifs_load_znode(c, zbr, znode, 0);
1547 zbr->znode = child;
1550 znode = child;
1560 err = znode_cb(c, znode, priv);
1562 ubifs_err("znode checking function returned "
1564 dbg_dump_znode(c, znode);
1568 if (leaf_cb && znode->level == 0) {
1569 for (idx = 0; idx < znode->child_cnt; idx++) {
1570 zbr = &znode->zbranch[idx];
1582 if (!znode->parent)
1585 idx = znode->iip + 1;
1586 znode = znode->parent;
1587 if (idx < znode->child_cnt) {
1589 zbr = &znode->zbranch[idx];
1590 child = zbr->znode;
1592 child = ubifs_load_znode(c, zbr, znode, idx);
1597 zbr->znode = child;
1599 znode = child;
1607 /* Go to the lowest leftmost znode in the new sub-tree */
1608 while (znode->level > 0) {
1609 zbr = &znode->zbranch[0];
1610 child = zbr->znode;
1612 child = ubifs_load_znode(c, zbr, znode, 0);
1617 zbr->znode = child;
1619 znode = child;
1627 if (znode->parent)
1628 zbr = &znode->parent->zbranch[znode->iip];
1631 ubifs_msg("dump of znode at LEB %d:%d", zbr->lnum, zbr->offs);
1632 dbg_dump_znode(c, znode);
1639 * add_size - add znode size to partially calculated index size.
1641 * @znode: znode to add size for
1648 static int add_size(struct ubifs_info *c, struct ubifs_znode *znode, void *priv)
1653 add = ubifs_idx_node_sz(c, znode->child_cnt);
1836 struct ubifs_znode *znode;
1846 err = ubifs_lookup_level0(c, &key, &znode, &n);
1856 zbr = &znode->zbranch[n];
2087 struct ubifs_znode *znode;
2171 err = ubifs_lookup_level0(c, &key, &znode, &n);
2182 zbr = &znode->zbranch[n];