Lines Matching refs:zbr
40 struct ubifs_zbranch *zbr, void *node);
126 struct ubifs_zbranch *zbr; in insert_old_idx_znode() local
128 zbr = &znode->parent->zbranch[znode->iip]; in insert_old_idx_znode()
129 if (zbr->len) in insert_old_idx_znode()
130 return insert_old_idx(c, zbr->lnum, zbr->offs); in insert_old_idx_znode()
151 struct ubifs_zbranch *zbr; in ins_clr_old_idx_znode() local
153 zbr = &znode->parent->zbranch[znode->iip]; in ins_clr_old_idx_znode()
154 if (zbr->len) { in ins_clr_old_idx_znode()
155 err = insert_old_idx(c, zbr->lnum, zbr->offs); in ins_clr_old_idx_znode()
158 zbr->lnum = 0; in ins_clr_old_idx_znode()
159 zbr->offs = 0; in ins_clr_old_idx_znode()
160 zbr->len = 0; in ins_clr_old_idx_znode()
223 struct ubifs_zbranch *zbr = &zn->zbranch[i]; in copy_znode() local
225 if (zbr->znode) in copy_znode()
226 zbr->znode->parent = zn; in copy_znode()
256 struct ubifs_zbranch *zbr) in dirty_cow_znode() argument
258 struct ubifs_znode *znode = zbr->znode; in dirty_cow_znode()
268 err = add_idx_dirt(c, zbr->lnum, zbr->len); in dirty_cow_znode()
279 if (zbr->len) { in dirty_cow_znode()
280 err = insert_old_idx(c, zbr->lnum, zbr->offs); in dirty_cow_znode()
283 err = add_idx_dirt(c, zbr->lnum, zbr->len); in dirty_cow_znode()
287 zbr->znode = zn; in dirty_cow_znode()
288 zbr->lnum = 0; in dirty_cow_znode()
289 zbr->offs = 0; in dirty_cow_znode()
290 zbr->len = 0; in dirty_cow_znode()
317 static int lnc_add(struct ubifs_info *c, struct ubifs_zbranch *zbr, in lnc_add() argument
324 ubifs_assert(c, !zbr->leaf); in lnc_add()
325 ubifs_assert(c, zbr->len != 0); in lnc_add()
326 ubifs_assert(c, is_hash_key(c, &zbr->key)); in lnc_add()
335 lnc_node = kmemdup(node, zbr->len, GFP_NOFS); in lnc_add()
340 zbr->leaf = lnc_node; in lnc_add()
353 static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr, in lnc_add_directly() argument
358 ubifs_assert(c, !zbr->leaf); in lnc_add_directly()
359 ubifs_assert(c, zbr->len != 0); in lnc_add_directly()
368 zbr->leaf = node; in lnc_add_directly()
377 static void lnc_free(struct ubifs_zbranch *zbr) in lnc_free() argument
379 if (!zbr->leaf) in lnc_free()
381 kfree(zbr->leaf); in lnc_free()
382 zbr->leaf = NULL; in lnc_free()
396 static int tnc_read_hashed_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, in tnc_read_hashed_node() argument
401 ubifs_assert(c, is_hash_key(c, &zbr->key)); in tnc_read_hashed_node()
403 if (zbr->leaf) { in tnc_read_hashed_node()
405 ubifs_assert(c, zbr->len != 0); in tnc_read_hashed_node()
406 memcpy(node, zbr->leaf, zbr->len); in tnc_read_hashed_node()
411 err = fallible_read_node(c, &zbr->key, zbr, node); in tnc_read_hashed_node()
421 err = ubifs_tnc_read_node(c, zbr, node); in tnc_read_hashed_node()
427 err = lnc_add(c, zbr, node); in tnc_read_hashed_node()
504 struct ubifs_zbranch *zbr, void *node) in fallible_read_node() argument
508 dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); in fallible_read_node()
510 ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum, in fallible_read_node()
511 zbr->offs); in fallible_read_node()
523 zbr->lnum, zbr->offs, zbr->len); in fallible_read_node()
538 static int matches_name(struct ubifs_info *c, struct ubifs_zbranch *zbr, in matches_name() argument
545 if (!zbr->leaf) { in matches_name()
546 dent = kmalloc(zbr->len, GFP_NOFS); in matches_name()
550 err = ubifs_tnc_read_node(c, zbr, dent); in matches_name()
555 err = lnc_add_directly(c, zbr, dent); in matches_name()
559 dent = zbr->leaf; in matches_name()
591 struct ubifs_zbranch *zbr; in get_znode() local
593 zbr = &znode->zbranch[n]; in get_znode()
594 if (zbr->znode) in get_znode()
595 znode = zbr->znode; in get_znode()
597 znode = ubifs_load_znode(c, zbr, znode, n); in get_znode()
826 struct ubifs_zbranch *zbr, in fallible_matches_name() argument
833 if (!zbr->leaf) { in fallible_matches_name()
834 dent = kmalloc(zbr->len, GFP_NOFS); in fallible_matches_name()
838 err = fallible_read_node(c, &zbr->key, zbr, dent); in fallible_matches_name()
848 err = lnc_add_directly(c, zbr, dent); in fallible_matches_name()
852 dent = zbr->leaf; in fallible_matches_name()
1015 static int matches_position(struct ubifs_zbranch *zbr, int lnum, int offs) in matches_position() argument
1017 if (zbr->lnum == lnum && zbr->offs == offs) in matches_position()
1133 struct ubifs_zbranch *zbr; in dirty_cow_bottom_up() local
1139 zbr = &zp->zbranch[path[--p]]; in dirty_cow_bottom_up()
1140 znode = dirty_cow_znode(c, zbr); in dirty_cow_bottom_up()
1197 struct ubifs_zbranch *zbr; in ubifs_lookup_level0() local
1206 zbr = &znode->zbranch[*n]; in ubifs_lookup_level0()
1208 if (zbr->znode) { in ubifs_lookup_level0()
1210 znode = zbr->znode; in ubifs_lookup_level0()
1215 znode = ubifs_load_znode(c, zbr, znode, *n); in ubifs_lookup_level0()
1336 struct ubifs_zbranch *zbr; in lookup_level0_dirty() local
1345 zbr = &znode->zbranch[*n]; in lookup_level0_dirty()
1347 if (zbr->znode) { in lookup_level0_dirty()
1349 znode = dirty_cow_znode(c, zbr); in lookup_level0_dirty()
1356 znode = ubifs_load_znode(c, zbr, znode, *n); in lookup_level0_dirty()
1359 znode = dirty_cow_znode(c, zbr); in lookup_level0_dirty()
1453 struct ubifs_zbranch zbr, *zt; in ubifs_tnc_locate() local
1483 zbr = znode->zbranch[n]; in ubifs_tnc_locate()
1487 if (ubifs_get_wbuf(c, zbr.lnum)) { in ubifs_tnc_locate()
1489 err = ubifs_tnc_read_node(c, &zbr, node); in ubifs_tnc_locate()
1493 err = fallible_read_node(c, key, &zbr, node); in ubifs_tnc_locate()
1494 if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) { in ubifs_tnc_locate()
1553 struct ubifs_zbranch *zbr; in ubifs_tnc_get_bu_keys() local
1561 zbr = &znode->zbranch[n]; in ubifs_tnc_get_bu_keys()
1562 key = &zbr->key; in ubifs_tnc_get_bu_keys()
1571 lnum = zbr->lnum; in ubifs_tnc_get_bu_keys()
1572 offs = ALIGN(zbr->offs + zbr->len, 8); in ubifs_tnc_get_bu_keys()
1573 len = zbr->len; in ubifs_tnc_get_bu_keys()
1583 if (zbr->lnum != lnum || zbr->offs != offs) in ubifs_tnc_get_bu_keys()
1585 offs += ALIGN(zbr->len, 8); in ubifs_tnc_get_bu_keys()
1586 len = ALIGN(len, 8) + zbr->len; in ubifs_tnc_get_bu_keys()
1598 bu->zbranch[bu->cnt++] = *zbr; in ubifs_tnc_get_bu_keys()
1698 struct ubifs_zbranch *zbr) in validate_data_node() argument
1710 err = ubifs_check_node(c, buf, zbr->lnum, zbr->offs, 0, 0); in validate_data_node()
1717 if (len != zbr->len) { in validate_data_node()
1718 ubifs_err(c, "bad node length %d, expected %d", len, zbr->len); in validate_data_node()
1724 if (!keys_eq(c, &zbr->key, &key1)) { in validate_data_node()
1726 zbr->lnum, zbr->offs); in validate_data_node()
1727 dbg_tnck(&zbr->key, "looked for key "); in validate_data_node()
1737 ubifs_err(c, "bad node at LEB %d:%d", zbr->lnum, zbr->offs); in validate_data_node()
1890 struct ubifs_zbranch *zbr; in search_dh_cookie() local
1894 zbr = &znode->zbranch[*n]; in search_dh_cookie()
1895 dkey = &zbr->key; in search_dh_cookie()
1902 err = tnc_read_hashed_node(c, zbr, dent); in search_dh_cookie()
2025 const struct ubifs_zbranch *zbr, int n) in insert_zbranch() argument
2037 if (zbr->znode) in insert_zbranch()
2038 zbr->znode->iip = n; in insert_zbranch()
2043 znode->zbranch[n] = *zbr; in insert_zbranch()
2077 struct ubifs_zbranch *zbr, int n) in tnc_insert() argument
2081 union ubifs_key *key = &zbr->key, *key1; in tnc_insert()
2092 insert_zbranch(c, znode, zbr, n); in tnc_insert()
2174 zbr->znode->parent = zn; in tnc_insert()
2201 insert_zbranch(c, zi, zbr, n); in tnc_insert()
2212 zbr->key = zn->zbranch[0].key; in tnc_insert()
2213 zbr->znode = zn; in tnc_insert()
2214 zbr->lnum = 0; in tnc_insert()
2215 zbr->offs = 0; in tnc_insert()
2216 zbr->len = 0; in tnc_insert()
2278 struct ubifs_zbranch zbr; in ubifs_tnc_add() local
2280 zbr.znode = NULL; in ubifs_tnc_add()
2281 zbr.lnum = lnum; in ubifs_tnc_add()
2282 zbr.offs = offs; in ubifs_tnc_add()
2283 zbr.len = len; in ubifs_tnc_add()
2284 key_copy(c, key, &zbr.key); in ubifs_tnc_add()
2285 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add()
2287 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_add() local
2289 lnc_free(zbr); in ubifs_tnc_add()
2290 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add()
2291 zbr->lnum = lnum; in ubifs_tnc_add()
2292 zbr->offs = offs; in ubifs_tnc_add()
2293 zbr->len = len; in ubifs_tnc_add()
2333 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_replace() local
2336 if (zbr->lnum == old_lnum && zbr->offs == old_offs) { in ubifs_tnc_replace()
2337 lnc_free(zbr); in ubifs_tnc_replace()
2338 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_replace()
2341 zbr->lnum = lnum; in ubifs_tnc_replace()
2342 zbr->offs = offs; in ubifs_tnc_replace()
2343 zbr->len = len; in ubifs_tnc_replace()
2364 zbr = &znode->zbranch[n]; in ubifs_tnc_replace()
2365 lnc_free(zbr); in ubifs_tnc_replace()
2366 err = ubifs_add_dirt(c, zbr->lnum, in ubifs_tnc_replace()
2367 zbr->len); in ubifs_tnc_replace()
2370 zbr->lnum = lnum; in ubifs_tnc_replace()
2371 zbr->offs = offs; in ubifs_tnc_replace()
2372 zbr->len = len; in ubifs_tnc_replace()
2437 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_add_nm() local
2439 lnc_free(zbr); in ubifs_tnc_add_nm()
2440 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add_nm()
2441 zbr->lnum = lnum; in ubifs_tnc_add_nm()
2442 zbr->offs = offs; in ubifs_tnc_add_nm()
2443 zbr->len = len; in ubifs_tnc_add_nm()
2449 struct ubifs_zbranch zbr; in ubifs_tnc_add_nm() local
2451 zbr.znode = NULL; in ubifs_tnc_add_nm()
2452 zbr.lnum = lnum; in ubifs_tnc_add_nm()
2453 zbr.offs = offs; in ubifs_tnc_add_nm()
2454 zbr.len = len; in ubifs_tnc_add_nm()
2455 key_copy(c, key, &zbr.key); in ubifs_tnc_add_nm()
2456 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add_nm()
2494 struct ubifs_zbranch *zbr; in tnc_delete() local
2503 zbr = &znode->zbranch[n]; in tnc_delete()
2504 lnc_free(zbr); in tnc_delete()
2506 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in tnc_delete()
2563 zbr = &znode->zbranch[0]; in tnc_delete()
2567 znode = dirty_cow_znode(c, zbr); in tnc_delete()
2578 c->zroot.lnum = zbr->lnum; in tnc_delete()
2579 c->zroot.offs = zbr->offs; in tnc_delete()
2580 c->zroot.len = zbr->len; in tnc_delete()
2690 struct ubifs_zbranch *zbr; in ubifs_tnc_remove_dh() local
2700 zbr = &znode->zbranch[n]; in ubifs_tnc_remove_dh()
2707 err = tnc_read_hashed_node(c, zbr, dent); in ubifs_tnc_remove_dh()
2944 struct ubifs_zbranch *zbr; in ubifs_tnc_next_ent() local
2991 zbr = &znode->zbranch[n]; in ubifs_tnc_next_ent()
2992 dent = kmalloc(zbr->len, GFP_NOFS); in ubifs_tnc_next_ent()
3002 dkey = &zbr->key; in ubifs_tnc_next_ent()
3009 err = tnc_read_hashed_node(c, zbr, dent); in ubifs_tnc_next_ent()
3323 struct ubifs_zbranch *zbr; in is_leaf_node_in_tnc() local
3333 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3334 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()
3353 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3354 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()
3369 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3370 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()