Lines Matching refs:zbr

26 			 struct ubifs_zbranch *zbr);
28 struct ubifs_zbranch *zbr, void *node);
114 struct ubifs_zbranch *zbr; in insert_old_idx_znode() local
116 zbr = &znode->parent->zbranch[znode->iip]; in insert_old_idx_znode()
117 if (zbr->len) in insert_old_idx_znode()
118 return insert_old_idx(c, zbr->lnum, zbr->offs); in insert_old_idx_znode()
139 struct ubifs_zbranch *zbr; in ins_clr_old_idx_znode() local
141 zbr = &znode->parent->zbranch[znode->iip]; in ins_clr_old_idx_znode()
142 if (zbr->len) { in ins_clr_old_idx_znode()
143 err = insert_old_idx(c, zbr->lnum, zbr->offs); in ins_clr_old_idx_znode()
146 zbr->lnum = 0; in ins_clr_old_idx_znode()
147 zbr->offs = 0; in ins_clr_old_idx_znode()
148 zbr->len = 0; in ins_clr_old_idx_znode()
211 struct ubifs_zbranch *zbr = &zn->zbranch[i]; in copy_znode() local
213 if (zbr->znode) in copy_znode()
214 zbr->znode->parent = zn; in copy_znode()
244 struct ubifs_zbranch *zbr) in dirty_cow_znode() argument
246 struct ubifs_znode *znode = zbr->znode; in dirty_cow_znode()
256 err = add_idx_dirt(c, zbr->lnum, zbr->len); in dirty_cow_znode()
267 if (zbr->len) { in dirty_cow_znode()
268 err = insert_old_idx(c, zbr->lnum, zbr->offs); in dirty_cow_znode()
271 err = add_idx_dirt(c, zbr->lnum, zbr->len); in dirty_cow_znode()
275 zbr->znode = zn; in dirty_cow_znode()
276 zbr->lnum = 0; in dirty_cow_znode()
277 zbr->offs = 0; in dirty_cow_znode()
278 zbr->len = 0; in dirty_cow_znode()
305 static int lnc_add(struct ubifs_info *c, struct ubifs_zbranch *zbr, in lnc_add() argument
312 ubifs_assert(c, !zbr->leaf); in lnc_add()
313 ubifs_assert(c, zbr->len != 0); in lnc_add()
314 ubifs_assert(c, is_hash_key(c, &zbr->key)); in lnc_add()
323 lnc_node = kmemdup(node, zbr->len, GFP_NOFS); in lnc_add()
328 zbr->leaf = lnc_node; in lnc_add()
341 static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr, in lnc_add_directly() argument
346 ubifs_assert(c, !zbr->leaf); in lnc_add_directly()
347 ubifs_assert(c, zbr->len != 0); in lnc_add_directly()
356 zbr->leaf = node; in lnc_add_directly()
364 static void lnc_free(struct ubifs_zbranch *zbr) in lnc_free() argument
366 if (!zbr->leaf) in lnc_free()
368 kfree(zbr->leaf); in lnc_free()
369 zbr->leaf = NULL; in lnc_free()
383 static int tnc_read_hashed_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, in tnc_read_hashed_node() argument
388 ubifs_assert(c, is_hash_key(c, &zbr->key)); in tnc_read_hashed_node()
390 if (zbr->leaf) { in tnc_read_hashed_node()
392 ubifs_assert(c, zbr->len != 0); in tnc_read_hashed_node()
393 memcpy(node, zbr->leaf, zbr->len); in tnc_read_hashed_node()
398 err = fallible_read_node(c, &zbr->key, zbr, node); in tnc_read_hashed_node()
408 err = ubifs_tnc_read_node(c, zbr, node); in tnc_read_hashed_node()
414 err = lnc_add(c, zbr, node); in tnc_read_hashed_node()
441 struct ubifs_zbranch *zbr) in try_read_node() argument
443 int len = zbr->len; in try_read_node()
444 int lnum = zbr->lnum; in try_read_node()
445 int offs = zbr->offs; in try_read_node()
477 err = ubifs_node_check_hash(c, buf, zbr->hash); in try_read_node()
479 ubifs_bad_hash(c, buf, zbr->hash, lnum, offs); in try_read_node()
497 struct ubifs_zbranch *zbr, void *node) in fallible_read_node() argument
501 dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); in fallible_read_node()
503 ret = try_read_node(c, node, key_type(c, key), zbr); in fallible_read_node()
515 zbr->lnum, zbr->offs, zbr->len); in fallible_read_node()
530 static int matches_name(struct ubifs_info *c, struct ubifs_zbranch *zbr, in matches_name() argument
537 if (!zbr->leaf) { in matches_name()
538 dent = kmalloc(zbr->len, GFP_NOFS); in matches_name()
542 err = ubifs_tnc_read_node(c, zbr, dent); in matches_name()
547 err = lnc_add_directly(c, zbr, dent); in matches_name()
551 dent = zbr->leaf; in matches_name()
583 struct ubifs_zbranch *zbr; in get_znode() local
585 zbr = &znode->zbranch[n]; in get_znode()
586 if (zbr->znode) in get_znode()
587 znode = zbr->znode; in get_znode()
589 znode = ubifs_load_znode(c, zbr, znode, n); in get_znode()
818 struct ubifs_zbranch *zbr, in fallible_matches_name() argument
825 if (!zbr->leaf) { in fallible_matches_name()
826 dent = kmalloc(zbr->len, GFP_NOFS); in fallible_matches_name()
830 err = fallible_read_node(c, &zbr->key, zbr, dent); in fallible_matches_name()
840 err = lnc_add_directly(c, zbr, dent); in fallible_matches_name()
844 dent = zbr->leaf; in fallible_matches_name()
1007 static int matches_position(struct ubifs_zbranch *zbr, int lnum, int offs) in matches_position() argument
1009 if (zbr->lnum == lnum && zbr->offs == offs) in matches_position()
1125 struct ubifs_zbranch *zbr; in dirty_cow_bottom_up() local
1131 zbr = &zp->zbranch[path[--p]]; in dirty_cow_bottom_up()
1132 znode = dirty_cow_znode(c, zbr); in dirty_cow_bottom_up()
1189 struct ubifs_zbranch *zbr; in ubifs_lookup_level0() local
1198 zbr = &znode->zbranch[*n]; in ubifs_lookup_level0()
1200 if (zbr->znode) { in ubifs_lookup_level0()
1202 znode = zbr->znode; in ubifs_lookup_level0()
1207 znode = ubifs_load_znode(c, zbr, znode, *n); in ubifs_lookup_level0()
1328 struct ubifs_zbranch *zbr; in lookup_level0_dirty() local
1337 zbr = &znode->zbranch[*n]; in lookup_level0_dirty()
1339 if (zbr->znode) { in lookup_level0_dirty()
1341 znode = dirty_cow_znode(c, zbr); in lookup_level0_dirty()
1348 znode = ubifs_load_znode(c, zbr, znode, *n); in lookup_level0_dirty()
1351 znode = dirty_cow_znode(c, zbr); in lookup_level0_dirty()
1445 struct ubifs_zbranch zbr, *zt; in ubifs_tnc_locate() local
1475 zbr = znode->zbranch[n]; in ubifs_tnc_locate()
1479 if (ubifs_get_wbuf(c, zbr.lnum)) { in ubifs_tnc_locate()
1481 err = ubifs_tnc_read_node(c, &zbr, node); in ubifs_tnc_locate()
1485 err = fallible_read_node(c, key, &zbr, node); in ubifs_tnc_locate()
1486 if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) { in ubifs_tnc_locate()
1545 struct ubifs_zbranch *zbr; in ubifs_tnc_get_bu_keys() local
1553 zbr = &znode->zbranch[n]; in ubifs_tnc_get_bu_keys()
1554 key = &zbr->key; in ubifs_tnc_get_bu_keys()
1563 lnum = zbr->lnum; in ubifs_tnc_get_bu_keys()
1564 offs = ALIGN(zbr->offs + zbr->len, 8); in ubifs_tnc_get_bu_keys()
1565 len = zbr->len; in ubifs_tnc_get_bu_keys()
1575 if (zbr->lnum != lnum || zbr->offs != offs) in ubifs_tnc_get_bu_keys()
1577 offs += ALIGN(zbr->len, 8); in ubifs_tnc_get_bu_keys()
1578 len = ALIGN(len, 8) + zbr->len; in ubifs_tnc_get_bu_keys()
1590 bu->zbranch[bu->cnt++] = *zbr; in ubifs_tnc_get_bu_keys()
1690 struct ubifs_zbranch *zbr) in validate_data_node() argument
1702 err = ubifs_check_node(c, buf, zbr->lnum, zbr->offs, 0, 0); in validate_data_node()
1708 err = ubifs_node_check_hash(c, buf, zbr->hash); in validate_data_node()
1710 ubifs_bad_hash(c, buf, zbr->hash, zbr->lnum, zbr->offs); in validate_data_node()
1715 if (len != zbr->len) { in validate_data_node()
1716 ubifs_err(c, "bad node length %d, expected %d", len, zbr->len); in validate_data_node()
1722 if (!keys_eq(c, &zbr->key, &key1)) { in validate_data_node()
1724 zbr->lnum, zbr->offs); in validate_data_node()
1725 dbg_tnck(&zbr->key, "looked for key "); in validate_data_node()
1735 ubifs_err(c, "bad node at LEB %d:%d", zbr->lnum, zbr->offs); in validate_data_node()
1888 struct ubifs_zbranch *zbr; in search_dh_cookie() local
1898 zbr = &znode->zbranch[*n]; in search_dh_cookie()
1899 dkey = &zbr->key; in search_dh_cookie()
1906 err = tnc_read_hashed_node(c, zbr, dent); in search_dh_cookie()
2029 const struct ubifs_zbranch *zbr, int n) in insert_zbranch() argument
2041 if (zbr->znode) in insert_zbranch()
2042 zbr->znode->iip = n; in insert_zbranch()
2047 znode->zbranch[n] = *zbr; in insert_zbranch()
2081 struct ubifs_zbranch *zbr, int n) in tnc_insert() argument
2085 union ubifs_key *key = &zbr->key, *key1; in tnc_insert()
2096 insert_zbranch(c, znode, zbr, n); in tnc_insert()
2178 zbr->znode->parent = zn; in tnc_insert()
2205 insert_zbranch(c, zi, zbr, n); in tnc_insert()
2216 zbr->key = zn->zbranch[0].key; in tnc_insert()
2217 zbr->znode = zn; in tnc_insert()
2218 zbr->lnum = 0; in tnc_insert()
2219 zbr->offs = 0; in tnc_insert()
2220 zbr->len = 0; in tnc_insert()
2283 struct ubifs_zbranch zbr; in ubifs_tnc_add() local
2285 zbr.znode = NULL; in ubifs_tnc_add()
2286 zbr.lnum = lnum; in ubifs_tnc_add()
2287 zbr.offs = offs; in ubifs_tnc_add()
2288 zbr.len = len; in ubifs_tnc_add()
2289 ubifs_copy_hash(c, hash, zbr.hash); in ubifs_tnc_add()
2290 key_copy(c, key, &zbr.key); in ubifs_tnc_add()
2291 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add()
2293 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_add() local
2295 lnc_free(zbr); in ubifs_tnc_add()
2296 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add()
2297 zbr->lnum = lnum; in ubifs_tnc_add()
2298 zbr->offs = offs; in ubifs_tnc_add()
2299 zbr->len = len; in ubifs_tnc_add()
2300 ubifs_copy_hash(c, hash, zbr->hash); in ubifs_tnc_add()
2340 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_replace() local
2343 if (zbr->lnum == old_lnum && zbr->offs == old_offs) { in ubifs_tnc_replace()
2344 lnc_free(zbr); in ubifs_tnc_replace()
2345 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_replace()
2348 zbr->lnum = lnum; in ubifs_tnc_replace()
2349 zbr->offs = offs; in ubifs_tnc_replace()
2350 zbr->len = len; in ubifs_tnc_replace()
2371 zbr = &znode->zbranch[n]; in ubifs_tnc_replace()
2372 lnc_free(zbr); in ubifs_tnc_replace()
2373 err = ubifs_add_dirt(c, zbr->lnum, in ubifs_tnc_replace()
2374 zbr->len); in ubifs_tnc_replace()
2377 zbr->lnum = lnum; in ubifs_tnc_replace()
2378 zbr->offs = offs; in ubifs_tnc_replace()
2379 zbr->len = len; in ubifs_tnc_replace()
2445 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_add_nm() local
2447 lnc_free(zbr); in ubifs_tnc_add_nm()
2448 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add_nm()
2449 zbr->lnum = lnum; in ubifs_tnc_add_nm()
2450 zbr->offs = offs; in ubifs_tnc_add_nm()
2451 zbr->len = len; in ubifs_tnc_add_nm()
2452 ubifs_copy_hash(c, hash, zbr->hash); in ubifs_tnc_add_nm()
2458 struct ubifs_zbranch zbr; in ubifs_tnc_add_nm() local
2460 zbr.znode = NULL; in ubifs_tnc_add_nm()
2461 zbr.lnum = lnum; in ubifs_tnc_add_nm()
2462 zbr.offs = offs; in ubifs_tnc_add_nm()
2463 zbr.len = len; in ubifs_tnc_add_nm()
2464 ubifs_copy_hash(c, hash, zbr.hash); in ubifs_tnc_add_nm()
2465 key_copy(c, key, &zbr.key); in ubifs_tnc_add_nm()
2466 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add_nm()
2504 struct ubifs_zbranch *zbr; in tnc_delete() local
2513 zbr = &znode->zbranch[n]; in tnc_delete()
2514 lnc_free(zbr); in tnc_delete()
2516 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in tnc_delete()
2573 zbr = &znode->zbranch[0]; in tnc_delete()
2577 znode = dirty_cow_znode(c, zbr); in tnc_delete()
2588 c->zroot.lnum = zbr->lnum; in tnc_delete()
2589 c->zroot.offs = zbr->offs; in tnc_delete()
2590 c->zroot.len = zbr->len; in tnc_delete()
2700 struct ubifs_zbranch *zbr; in ubifs_tnc_remove_dh() local
2710 zbr = &znode->zbranch[n]; in ubifs_tnc_remove_dh()
2717 err = tnc_read_hashed_node(c, zbr, dent); in ubifs_tnc_remove_dh()
2957 struct ubifs_zbranch *zbr; in ubifs_tnc_next_ent() local
3004 zbr = &znode->zbranch[n]; in ubifs_tnc_next_ent()
3005 dent = kmalloc(zbr->len, GFP_NOFS); in ubifs_tnc_next_ent()
3015 dkey = &zbr->key; in ubifs_tnc_next_ent()
3022 err = tnc_read_hashed_node(c, zbr, dent); in ubifs_tnc_next_ent()
3336 struct ubifs_zbranch *zbr; in is_leaf_node_in_tnc() local
3346 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3347 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()
3366 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3367 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()
3382 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3383 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()