Lines Matching refs:zbr
26 struct ubifs_zbranch *zbr);
28 struct ubifs_zbranch *zbr, void *node);
122 struct ubifs_zbranch *zbr; in insert_old_idx_znode() local
124 zbr = &znode->parent->zbranch[znode->iip]; in insert_old_idx_znode()
125 if (zbr->len) in insert_old_idx_znode()
126 return insert_old_idx(c, zbr->lnum, zbr->offs); in insert_old_idx_znode()
147 struct ubifs_zbranch *zbr; in ins_clr_old_idx_znode() local
149 zbr = &znode->parent->zbranch[znode->iip]; in ins_clr_old_idx_znode()
150 if (zbr->len) { in ins_clr_old_idx_znode()
151 err = insert_old_idx(c, zbr->lnum, zbr->offs); in ins_clr_old_idx_znode()
154 zbr->lnum = 0; in ins_clr_old_idx_znode()
155 zbr->offs = 0; in ins_clr_old_idx_znode()
156 zbr->len = 0; in ins_clr_old_idx_znode()
237 struct ubifs_znode *old_zn, struct ubifs_zbranch *zbr) in replace_znode() argument
255 zbr->znode = new_zn; in replace_znode()
256 zbr->lnum = 0; in replace_znode()
257 zbr->offs = 0; in replace_znode()
258 zbr->len = 0; in replace_znode()
271 struct ubifs_zbranch *zbr) in dirty_cow_znode() argument
273 struct ubifs_znode *znode = zbr->znode; in dirty_cow_znode()
283 err = add_idx_dirt(c, zbr->lnum, zbr->len); in dirty_cow_znode()
294 if (zbr->len) { in dirty_cow_znode()
302 old_idx->lnum = zbr->lnum; in dirty_cow_znode()
303 old_idx->offs = zbr->offs; in dirty_cow_znode()
305 err = add_idx_dirt(c, zbr->lnum, zbr->len); in dirty_cow_znode()
314 replace_znode(c, zn, znode, zbr); in dirty_cow_znode()
343 static int lnc_add(struct ubifs_info *c, struct ubifs_zbranch *zbr, in lnc_add() argument
350 ubifs_assert(c, !zbr->leaf); in lnc_add()
351 ubifs_assert(c, zbr->len != 0); in lnc_add()
352 ubifs_assert(c, is_hash_key(c, &zbr->key)); in lnc_add()
357 ubifs_dump_node(c, dent, zbr->len); in lnc_add()
361 lnc_node = kmemdup(node, zbr->len, GFP_NOFS); in lnc_add()
366 zbr->leaf = lnc_node; in lnc_add()
379 static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr, in lnc_add_directly() argument
384 ubifs_assert(c, !zbr->leaf); in lnc_add_directly()
385 ubifs_assert(c, zbr->len != 0); in lnc_add_directly()
390 ubifs_dump_node(c, node, zbr->len); in lnc_add_directly()
394 zbr->leaf = node; in lnc_add_directly()
402 static void lnc_free(struct ubifs_zbranch *zbr) in lnc_free() argument
404 if (!zbr->leaf) in lnc_free()
406 kfree(zbr->leaf); in lnc_free()
407 zbr->leaf = NULL; in lnc_free()
421 static int tnc_read_hashed_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, in tnc_read_hashed_node() argument
426 ubifs_assert(c, is_hash_key(c, &zbr->key)); in tnc_read_hashed_node()
428 if (zbr->leaf) { in tnc_read_hashed_node()
430 ubifs_assert(c, zbr->len != 0); in tnc_read_hashed_node()
431 memcpy(node, zbr->leaf, zbr->len); in tnc_read_hashed_node()
436 err = fallible_read_node(c, &zbr->key, zbr, node); in tnc_read_hashed_node()
446 err = ubifs_tnc_read_node(c, zbr, node); in tnc_read_hashed_node()
452 err = lnc_add(c, zbr, node); in tnc_read_hashed_node()
479 struct ubifs_zbranch *zbr) in try_read_node() argument
481 int len = zbr->len; in try_read_node()
482 int lnum = zbr->lnum; in try_read_node()
483 int offs = zbr->offs; in try_read_node()
515 err = ubifs_node_check_hash(c, buf, zbr->hash); in try_read_node()
517 ubifs_bad_hash(c, buf, zbr->hash, lnum, offs); in try_read_node()
535 struct ubifs_zbranch *zbr, void *node) in fallible_read_node() argument
539 dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); in fallible_read_node()
541 ret = try_read_node(c, node, key_type(c, key), zbr); in fallible_read_node()
553 zbr->lnum, zbr->offs, zbr->len); in fallible_read_node()
568 static int matches_name(struct ubifs_info *c, struct ubifs_zbranch *zbr, in matches_name() argument
575 if (!zbr->leaf) { in matches_name()
576 dent = kmalloc(zbr->len, GFP_NOFS); in matches_name()
580 err = ubifs_tnc_read_node(c, zbr, dent); in matches_name()
585 err = lnc_add_directly(c, zbr, dent); in matches_name()
589 dent = zbr->leaf; in matches_name()
621 struct ubifs_zbranch *zbr; in get_znode() local
623 zbr = &znode->zbranch[n]; in get_znode()
624 if (zbr->znode) in get_znode()
625 znode = zbr->znode; in get_znode()
627 znode = ubifs_load_znode(c, zbr, znode, n); in get_znode()
856 struct ubifs_zbranch *zbr, in fallible_matches_name() argument
863 if (!zbr->leaf) { in fallible_matches_name()
864 dent = kmalloc(zbr->len, GFP_NOFS); in fallible_matches_name()
868 err = fallible_read_node(c, &zbr->key, zbr, dent); in fallible_matches_name()
878 err = lnc_add_directly(c, zbr, dent); in fallible_matches_name()
882 dent = zbr->leaf; in fallible_matches_name()
1045 static int matches_position(struct ubifs_zbranch *zbr, int lnum, int offs) in matches_position() argument
1047 if (zbr->lnum == lnum && zbr->offs == offs) in matches_position()
1163 struct ubifs_zbranch *zbr; in dirty_cow_bottom_up() local
1169 zbr = &zp->zbranch[path[--p]]; in dirty_cow_bottom_up()
1170 znode = dirty_cow_znode(c, zbr); in dirty_cow_bottom_up()
1227 struct ubifs_zbranch *zbr; in ubifs_lookup_level0() local
1236 zbr = &znode->zbranch[*n]; in ubifs_lookup_level0()
1238 if (zbr->znode) { in ubifs_lookup_level0()
1240 znode = zbr->znode; in ubifs_lookup_level0()
1245 znode = ubifs_load_znode(c, zbr, znode, *n); in ubifs_lookup_level0()
1366 struct ubifs_zbranch *zbr; in lookup_level0_dirty() local
1375 zbr = &znode->zbranch[*n]; in lookup_level0_dirty()
1377 if (zbr->znode) { in lookup_level0_dirty()
1379 znode = dirty_cow_znode(c, zbr); in lookup_level0_dirty()
1386 znode = ubifs_load_znode(c, zbr, znode, *n); in lookup_level0_dirty()
1389 znode = dirty_cow_znode(c, zbr); in lookup_level0_dirty()
1483 struct ubifs_zbranch zbr, *zt; in ubifs_tnc_locate() local
1513 zbr = znode->zbranch[n]; in ubifs_tnc_locate()
1517 if (ubifs_get_wbuf(c, zbr.lnum)) { in ubifs_tnc_locate()
1519 err = ubifs_tnc_read_node(c, &zbr, node); in ubifs_tnc_locate()
1523 err = fallible_read_node(c, key, &zbr, node); in ubifs_tnc_locate()
1524 if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) { in ubifs_tnc_locate()
1583 struct ubifs_zbranch *zbr; in ubifs_tnc_get_bu_keys() local
1591 zbr = &znode->zbranch[n]; in ubifs_tnc_get_bu_keys()
1592 key = &zbr->key; in ubifs_tnc_get_bu_keys()
1601 lnum = zbr->lnum; in ubifs_tnc_get_bu_keys()
1602 offs = ALIGN(zbr->offs + zbr->len, 8); in ubifs_tnc_get_bu_keys()
1603 len = zbr->len; in ubifs_tnc_get_bu_keys()
1613 if (zbr->lnum != lnum || zbr->offs != offs) in ubifs_tnc_get_bu_keys()
1615 offs += ALIGN(zbr->len, 8); in ubifs_tnc_get_bu_keys()
1616 len = ALIGN(len, 8) + zbr->len; in ubifs_tnc_get_bu_keys()
1628 bu->zbranch[bu->cnt++] = *zbr; in ubifs_tnc_get_bu_keys()
1728 struct ubifs_zbranch *zbr) in validate_data_node() argument
1740 err = ubifs_check_node(c, buf, zbr->len, zbr->lnum, zbr->offs, 0, 0); in validate_data_node()
1746 err = ubifs_node_check_hash(c, buf, zbr->hash); in validate_data_node()
1748 ubifs_bad_hash(c, buf, zbr->hash, zbr->lnum, zbr->offs); in validate_data_node()
1753 if (len != zbr->len) { in validate_data_node()
1754 ubifs_err(c, "bad node length %d, expected %d", len, zbr->len); in validate_data_node()
1760 if (!keys_eq(c, &zbr->key, &key1)) { in validate_data_node()
1762 zbr->lnum, zbr->offs); in validate_data_node()
1763 dbg_tnck(&zbr->key, "looked for key "); in validate_data_node()
1773 ubifs_err(c, "bad node at LEB %d:%d", zbr->lnum, zbr->offs); in validate_data_node()
1774 ubifs_dump_node(c, buf, zbr->len); in validate_data_node()
1926 struct ubifs_zbranch *zbr; in search_dh_cookie() local
1936 zbr = &znode->zbranch[*n]; in search_dh_cookie()
1937 dkey = &zbr->key; in search_dh_cookie()
1944 err = tnc_read_hashed_node(c, zbr, dent); in search_dh_cookie()
2067 const struct ubifs_zbranch *zbr, int n) in insert_zbranch() argument
2079 if (zbr->znode) in insert_zbranch()
2080 zbr->znode->iip = n; in insert_zbranch()
2085 znode->zbranch[n] = *zbr; in insert_zbranch()
2119 struct ubifs_zbranch *zbr, int n) in tnc_insert() argument
2123 union ubifs_key *key = &zbr->key, *key1; in tnc_insert()
2134 insert_zbranch(c, znode, zbr, n); in tnc_insert()
2216 zbr->znode->parent = zn; in tnc_insert()
2243 insert_zbranch(c, zi, zbr, n); in tnc_insert()
2254 zbr->key = zn->zbranch[0].key; in tnc_insert()
2255 zbr->znode = zn; in tnc_insert()
2256 zbr->lnum = 0; in tnc_insert()
2257 zbr->offs = 0; in tnc_insert()
2258 zbr->len = 0; in tnc_insert()
2321 struct ubifs_zbranch zbr; in ubifs_tnc_add() local
2323 zbr.znode = NULL; in ubifs_tnc_add()
2324 zbr.lnum = lnum; in ubifs_tnc_add()
2325 zbr.offs = offs; in ubifs_tnc_add()
2326 zbr.len = len; in ubifs_tnc_add()
2327 ubifs_copy_hash(c, hash, zbr.hash); in ubifs_tnc_add()
2328 key_copy(c, key, &zbr.key); in ubifs_tnc_add()
2329 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add()
2331 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_add() local
2333 lnc_free(zbr); in ubifs_tnc_add()
2334 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add()
2335 zbr->lnum = lnum; in ubifs_tnc_add()
2336 zbr->offs = offs; in ubifs_tnc_add()
2337 zbr->len = len; in ubifs_tnc_add()
2338 ubifs_copy_hash(c, hash, zbr->hash); in ubifs_tnc_add()
2378 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_replace() local
2381 if (zbr->lnum == old_lnum && zbr->offs == old_offs) { in ubifs_tnc_replace()
2382 lnc_free(zbr); in ubifs_tnc_replace()
2383 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_replace()
2386 zbr->lnum = lnum; in ubifs_tnc_replace()
2387 zbr->offs = offs; in ubifs_tnc_replace()
2388 zbr->len = len; in ubifs_tnc_replace()
2409 zbr = &znode->zbranch[n]; in ubifs_tnc_replace()
2410 lnc_free(zbr); in ubifs_tnc_replace()
2411 err = ubifs_add_dirt(c, zbr->lnum, in ubifs_tnc_replace()
2412 zbr->len); in ubifs_tnc_replace()
2415 zbr->lnum = lnum; in ubifs_tnc_replace()
2416 zbr->offs = offs; in ubifs_tnc_replace()
2417 zbr->len = len; in ubifs_tnc_replace()
2483 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_add_nm() local
2485 lnc_free(zbr); in ubifs_tnc_add_nm()
2486 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add_nm()
2487 zbr->lnum = lnum; in ubifs_tnc_add_nm()
2488 zbr->offs = offs; in ubifs_tnc_add_nm()
2489 zbr->len = len; in ubifs_tnc_add_nm()
2490 ubifs_copy_hash(c, hash, zbr->hash); in ubifs_tnc_add_nm()
2496 struct ubifs_zbranch zbr; in ubifs_tnc_add_nm() local
2498 zbr.znode = NULL; in ubifs_tnc_add_nm()
2499 zbr.lnum = lnum; in ubifs_tnc_add_nm()
2500 zbr.offs = offs; in ubifs_tnc_add_nm()
2501 zbr.len = len; in ubifs_tnc_add_nm()
2502 ubifs_copy_hash(c, hash, zbr.hash); in ubifs_tnc_add_nm()
2503 key_copy(c, key, &zbr.key); in ubifs_tnc_add_nm()
2504 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add_nm()
2542 struct ubifs_zbranch *zbr; in tnc_delete() local
2551 zbr = &znode->zbranch[n]; in tnc_delete()
2552 lnc_free(zbr); in tnc_delete()
2554 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in tnc_delete()
2611 zbr = &znode->zbranch[0]; in tnc_delete()
2615 znode = dirty_cow_znode(c, zbr); in tnc_delete()
2626 c->zroot.lnum = zbr->lnum; in tnc_delete()
2627 c->zroot.offs = zbr->offs; in tnc_delete()
2628 c->zroot.len = zbr->len; in tnc_delete()
2738 struct ubifs_zbranch *zbr; in ubifs_tnc_remove_dh() local
2748 zbr = &znode->zbranch[n]; in ubifs_tnc_remove_dh()
2755 err = tnc_read_hashed_node(c, zbr, dent); in ubifs_tnc_remove_dh()
2995 struct ubifs_zbranch *zbr; in ubifs_tnc_next_ent() local
3042 zbr = &znode->zbranch[n]; in ubifs_tnc_next_ent()
3043 dent = kmalloc(zbr->len, GFP_NOFS); in ubifs_tnc_next_ent()
3053 dkey = &zbr->key; in ubifs_tnc_next_ent()
3060 err = tnc_read_hashed_node(c, zbr, dent); in ubifs_tnc_next_ent()
3389 struct ubifs_zbranch *zbr; in is_leaf_node_in_tnc() local
3399 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3400 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()
3419 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3420 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()
3435 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3436 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()