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()
1162 struct ubifs_zbranch *zbr; in dirty_cow_bottom_up() local
1168 zbr = &zp->zbranch[path[--p]]; in dirty_cow_bottom_up()
1169 znode = dirty_cow_znode(c, zbr); in dirty_cow_bottom_up()
1226 struct ubifs_zbranch *zbr; in ubifs_lookup_level0() local
1235 zbr = &znode->zbranch[*n]; in ubifs_lookup_level0()
1237 if (zbr->znode) { in ubifs_lookup_level0()
1239 znode = zbr->znode; in ubifs_lookup_level0()
1244 znode = ubifs_load_znode(c, zbr, znode, *n); in ubifs_lookup_level0()
1365 struct ubifs_zbranch *zbr; in lookup_level0_dirty() local
1374 zbr = &znode->zbranch[*n]; in lookup_level0_dirty()
1376 if (zbr->znode) { in lookup_level0_dirty()
1378 znode = dirty_cow_znode(c, zbr); in lookup_level0_dirty()
1385 znode = ubifs_load_znode(c, zbr, znode, *n); in lookup_level0_dirty()
1388 znode = dirty_cow_znode(c, zbr); in lookup_level0_dirty()
1482 struct ubifs_zbranch zbr, *zt; in ubifs_tnc_locate() local
1512 zbr = znode->zbranch[n]; in ubifs_tnc_locate()
1516 if (ubifs_get_wbuf(c, zbr.lnum)) { in ubifs_tnc_locate()
1518 err = ubifs_tnc_read_node(c, &zbr, node); in ubifs_tnc_locate()
1522 err = fallible_read_node(c, key, &zbr, node); in ubifs_tnc_locate()
1523 if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) { in ubifs_tnc_locate()
1582 struct ubifs_zbranch *zbr; in ubifs_tnc_get_bu_keys() local
1590 zbr = &znode->zbranch[n]; in ubifs_tnc_get_bu_keys()
1591 key = &zbr->key; in ubifs_tnc_get_bu_keys()
1600 lnum = zbr->lnum; in ubifs_tnc_get_bu_keys()
1601 offs = ALIGN(zbr->offs + zbr->len, 8); in ubifs_tnc_get_bu_keys()
1602 len = zbr->len; in ubifs_tnc_get_bu_keys()
1612 if (zbr->lnum != lnum || zbr->offs != offs) in ubifs_tnc_get_bu_keys()
1614 offs += ALIGN(zbr->len, 8); in ubifs_tnc_get_bu_keys()
1615 len = ALIGN(len, 8) + zbr->len; in ubifs_tnc_get_bu_keys()
1627 bu->zbranch[bu->cnt++] = *zbr; in ubifs_tnc_get_bu_keys()
1727 struct ubifs_zbranch *zbr) in validate_data_node() argument
1739 err = ubifs_check_node(c, buf, zbr->len, zbr->lnum, zbr->offs, 0, 0); in validate_data_node()
1745 err = ubifs_node_check_hash(c, buf, zbr->hash); in validate_data_node()
1747 ubifs_bad_hash(c, buf, zbr->hash, zbr->lnum, zbr->offs); in validate_data_node()
1752 if (len != zbr->len) { in validate_data_node()
1753 ubifs_err(c, "bad node length %d, expected %d", len, zbr->len); in validate_data_node()
1759 if (!keys_eq(c, &zbr->key, &key1)) { in validate_data_node()
1761 zbr->lnum, zbr->offs); in validate_data_node()
1762 dbg_tnck(&zbr->key, "looked for key "); in validate_data_node()
1772 ubifs_err(c, "bad node at LEB %d:%d", zbr->lnum, zbr->offs); in validate_data_node()
1773 ubifs_dump_node(c, buf, zbr->len); in validate_data_node()
1925 struct ubifs_zbranch *zbr; in search_dh_cookie() local
1935 zbr = &znode->zbranch[*n]; in search_dh_cookie()
1936 dkey = &zbr->key; in search_dh_cookie()
1943 err = tnc_read_hashed_node(c, zbr, dent); in search_dh_cookie()
2066 const struct ubifs_zbranch *zbr, int n) in insert_zbranch() argument
2078 if (zbr->znode) in insert_zbranch()
2079 zbr->znode->iip = n; in insert_zbranch()
2084 znode->zbranch[n] = *zbr; in insert_zbranch()
2118 struct ubifs_zbranch *zbr, int n) in tnc_insert() argument
2122 union ubifs_key *key = &zbr->key, *key1; in tnc_insert()
2133 insert_zbranch(c, znode, zbr, n); in tnc_insert()
2215 zbr->znode->parent = zn; in tnc_insert()
2242 insert_zbranch(c, zi, zbr, n); in tnc_insert()
2253 zbr->key = zn->zbranch[0].key; in tnc_insert()
2254 zbr->znode = zn; in tnc_insert()
2255 zbr->lnum = 0; in tnc_insert()
2256 zbr->offs = 0; in tnc_insert()
2257 zbr->len = 0; in tnc_insert()
2320 struct ubifs_zbranch zbr; in ubifs_tnc_add() local
2322 zbr.znode = NULL; in ubifs_tnc_add()
2323 zbr.lnum = lnum; in ubifs_tnc_add()
2324 zbr.offs = offs; in ubifs_tnc_add()
2325 zbr.len = len; in ubifs_tnc_add()
2326 ubifs_copy_hash(c, hash, zbr.hash); in ubifs_tnc_add()
2327 key_copy(c, key, &zbr.key); in ubifs_tnc_add()
2328 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add()
2330 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_add() local
2332 lnc_free(zbr); in ubifs_tnc_add()
2333 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add()
2334 zbr->lnum = lnum; in ubifs_tnc_add()
2335 zbr->offs = offs; in ubifs_tnc_add()
2336 zbr->len = len; in ubifs_tnc_add()
2337 ubifs_copy_hash(c, hash, zbr->hash); in ubifs_tnc_add()
2377 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_replace() local
2380 if (zbr->lnum == old_lnum && zbr->offs == old_offs) { in ubifs_tnc_replace()
2381 lnc_free(zbr); in ubifs_tnc_replace()
2382 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_replace()
2385 zbr->lnum = lnum; in ubifs_tnc_replace()
2386 zbr->offs = offs; in ubifs_tnc_replace()
2387 zbr->len = len; in ubifs_tnc_replace()
2408 zbr = &znode->zbranch[n]; in ubifs_tnc_replace()
2409 lnc_free(zbr); in ubifs_tnc_replace()
2410 err = ubifs_add_dirt(c, zbr->lnum, in ubifs_tnc_replace()
2411 zbr->len); in ubifs_tnc_replace()
2414 zbr->lnum = lnum; in ubifs_tnc_replace()
2415 zbr->offs = offs; in ubifs_tnc_replace()
2416 zbr->len = len; in ubifs_tnc_replace()
2482 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_add_nm() local
2484 lnc_free(zbr); in ubifs_tnc_add_nm()
2485 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add_nm()
2486 zbr->lnum = lnum; in ubifs_tnc_add_nm()
2487 zbr->offs = offs; in ubifs_tnc_add_nm()
2488 zbr->len = len; in ubifs_tnc_add_nm()
2489 ubifs_copy_hash(c, hash, zbr->hash); in ubifs_tnc_add_nm()
2495 struct ubifs_zbranch zbr; in ubifs_tnc_add_nm() local
2497 zbr.znode = NULL; in ubifs_tnc_add_nm()
2498 zbr.lnum = lnum; in ubifs_tnc_add_nm()
2499 zbr.offs = offs; in ubifs_tnc_add_nm()
2500 zbr.len = len; in ubifs_tnc_add_nm()
2501 ubifs_copy_hash(c, hash, zbr.hash); in ubifs_tnc_add_nm()
2502 key_copy(c, key, &zbr.key); in ubifs_tnc_add_nm()
2503 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add_nm()
2541 struct ubifs_zbranch *zbr; in tnc_delete() local
2550 zbr = &znode->zbranch[n]; in tnc_delete()
2551 lnc_free(zbr); in tnc_delete()
2553 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in tnc_delete()
2610 zbr = &znode->zbranch[0]; in tnc_delete()
2614 znode = dirty_cow_znode(c, zbr); in tnc_delete()
2625 c->zroot.lnum = zbr->lnum; in tnc_delete()
2626 c->zroot.offs = zbr->offs; in tnc_delete()
2627 c->zroot.len = zbr->len; in tnc_delete()
2737 struct ubifs_zbranch *zbr; in ubifs_tnc_remove_dh() local
2747 zbr = &znode->zbranch[n]; in ubifs_tnc_remove_dh()
2754 err = tnc_read_hashed_node(c, zbr, dent); in ubifs_tnc_remove_dh()
2992 struct ubifs_zbranch *zbr; in ubifs_tnc_next_ent() local
3039 zbr = &znode->zbranch[n]; in ubifs_tnc_next_ent()
3040 dent = kmalloc(zbr->len, GFP_NOFS); in ubifs_tnc_next_ent()
3050 dkey = &zbr->key; in ubifs_tnc_next_ent()
3057 err = tnc_read_hashed_node(c, zbr, dent); in ubifs_tnc_next_ent()
3379 struct ubifs_zbranch *zbr; in is_leaf_node_in_tnc() local
3389 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3390 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()
3409 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3410 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()
3425 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3426 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()