Lines Matching refs:zbr

121 		struct ubifs_zbranch *zbr;  in insert_old_idx_znode()  local
123 zbr = &znode->parent->zbranch[znode->iip]; in insert_old_idx_znode()
124 if (zbr->len) in insert_old_idx_znode()
125 return insert_old_idx(c, zbr->lnum, zbr->offs); in insert_old_idx_znode()
146 struct ubifs_zbranch *zbr; in ins_clr_old_idx_znode() local
148 zbr = &znode->parent->zbranch[znode->iip]; in ins_clr_old_idx_znode()
149 if (zbr->len) { in ins_clr_old_idx_znode()
150 err = insert_old_idx(c, zbr->lnum, zbr->offs); in ins_clr_old_idx_znode()
153 zbr->lnum = 0; in ins_clr_old_idx_znode()
154 zbr->offs = 0; in ins_clr_old_idx_znode()
155 zbr->len = 0; in ins_clr_old_idx_znode()
219 struct ubifs_zbranch *zbr = &zn->zbranch[i]; in copy_znode() local
221 if (zbr->znode) in copy_znode()
222 zbr->znode->parent = zn; in copy_znode()
252 struct ubifs_zbranch *zbr) in dirty_cow_znode() argument
254 struct ubifs_znode *znode = zbr->znode; in dirty_cow_znode()
264 err = add_idx_dirt(c, zbr->lnum, zbr->len); in dirty_cow_znode()
275 if (zbr->len) { in dirty_cow_znode()
276 err = insert_old_idx(c, zbr->lnum, zbr->offs); in dirty_cow_znode()
279 err = add_idx_dirt(c, zbr->lnum, zbr->len); in dirty_cow_znode()
283 zbr->znode = zn; in dirty_cow_znode()
284 zbr->lnum = 0; in dirty_cow_znode()
285 zbr->offs = 0; in dirty_cow_znode()
286 zbr->len = 0; in dirty_cow_znode()
313 static int lnc_add(struct ubifs_info *c, struct ubifs_zbranch *zbr, in lnc_add() argument
320 ubifs_assert(!zbr->leaf); in lnc_add()
321 ubifs_assert(zbr->len != 0); in lnc_add()
322 ubifs_assert(is_hash_key(c, &zbr->key)); in lnc_add()
331 lnc_node = kmemdup(node, zbr->len, GFP_NOFS); in lnc_add()
336 zbr->leaf = lnc_node; in lnc_add()
349 static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr, in lnc_add_directly() argument
354 ubifs_assert(!zbr->leaf); in lnc_add_directly()
355 ubifs_assert(zbr->len != 0); in lnc_add_directly()
364 zbr->leaf = node; in lnc_add_directly()
373 static void lnc_free(struct ubifs_zbranch *zbr) in lnc_free() argument
375 if (!zbr->leaf) in lnc_free()
377 kfree(zbr->leaf); in lnc_free()
378 zbr->leaf = NULL; in lnc_free()
392 static int tnc_read_node_nm(struct ubifs_info *c, struct ubifs_zbranch *zbr, in tnc_read_node_nm() argument
397 ubifs_assert(is_hash_key(c, &zbr->key)); in tnc_read_node_nm()
399 if (zbr->leaf) { in tnc_read_node_nm()
401 ubifs_assert(zbr->len != 0); in tnc_read_node_nm()
402 memcpy(node, zbr->leaf, zbr->len); in tnc_read_node_nm()
406 err = ubifs_tnc_read_node(c, zbr, node); in tnc_read_node_nm()
411 err = lnc_add(c, zbr, node); in tnc_read_node_nm()
488 struct ubifs_zbranch *zbr, void *node) in fallible_read_node() argument
492 dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); in fallible_read_node()
494 ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum, in fallible_read_node()
495 zbr->offs); in fallible_read_node()
507 zbr->lnum, zbr->offs, zbr->len); in fallible_read_node()
522 static int matches_name(struct ubifs_info *c, struct ubifs_zbranch *zbr, in matches_name() argument
529 if (!zbr->leaf) { in matches_name()
530 dent = kmalloc(zbr->len, GFP_NOFS); in matches_name()
534 err = ubifs_tnc_read_node(c, zbr, dent); in matches_name()
539 err = lnc_add_directly(c, zbr, dent); in matches_name()
543 dent = zbr->leaf; in matches_name()
575 struct ubifs_zbranch *zbr; in get_znode() local
577 zbr = &znode->zbranch[n]; in get_znode()
578 if (zbr->znode) in get_znode()
579 znode = zbr->znode; in get_znode()
581 znode = ubifs_load_znode(c, zbr, znode, n); in get_znode()
810 struct ubifs_zbranch *zbr, in fallible_matches_name() argument
817 if (!zbr->leaf) { in fallible_matches_name()
818 dent = kmalloc(zbr->len, GFP_NOFS); in fallible_matches_name()
822 err = fallible_read_node(c, &zbr->key, zbr, dent); in fallible_matches_name()
832 err = lnc_add_directly(c, zbr, dent); in fallible_matches_name()
836 dent = zbr->leaf; in fallible_matches_name()
998 static int matches_position(struct ubifs_zbranch *zbr, int lnum, int offs) in matches_position() argument
1000 if (zbr->lnum == lnum && zbr->offs == offs) in matches_position()
1115 struct ubifs_zbranch *zbr; in dirty_cow_bottom_up() local
1121 zbr = &zp->zbranch[path[--p]]; in dirty_cow_bottom_up()
1122 znode = dirty_cow_znode(c, zbr); in dirty_cow_bottom_up()
1179 struct ubifs_zbranch *zbr; in ubifs_lookup_level0() local
1188 zbr = &znode->zbranch[*n]; in ubifs_lookup_level0()
1190 if (zbr->znode) { in ubifs_lookup_level0()
1192 znode = zbr->znode; in ubifs_lookup_level0()
1197 znode = ubifs_load_znode(c, zbr, znode, *n); in ubifs_lookup_level0()
1318 struct ubifs_zbranch *zbr; in lookup_level0_dirty() local
1327 zbr = &znode->zbranch[*n]; in lookup_level0_dirty()
1329 if (zbr->znode) { in lookup_level0_dirty()
1331 znode = dirty_cow_znode(c, zbr); in lookup_level0_dirty()
1338 znode = ubifs_load_znode(c, zbr, znode, *n); in lookup_level0_dirty()
1341 znode = dirty_cow_znode(c, zbr); in lookup_level0_dirty()
1435 struct ubifs_zbranch zbr, *zt; in ubifs_tnc_locate() local
1465 zbr = znode->zbranch[n]; in ubifs_tnc_locate()
1469 if (ubifs_get_wbuf(c, zbr.lnum)) { in ubifs_tnc_locate()
1471 err = ubifs_tnc_read_node(c, &zbr, node); in ubifs_tnc_locate()
1475 err = fallible_read_node(c, key, &zbr, node); in ubifs_tnc_locate()
1476 if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) { in ubifs_tnc_locate()
1535 struct ubifs_zbranch *zbr; in ubifs_tnc_get_bu_keys() local
1543 zbr = &znode->zbranch[n]; in ubifs_tnc_get_bu_keys()
1544 key = &zbr->key; in ubifs_tnc_get_bu_keys()
1553 lnum = zbr->lnum; in ubifs_tnc_get_bu_keys()
1554 offs = ALIGN(zbr->offs + zbr->len, 8); in ubifs_tnc_get_bu_keys()
1555 len = zbr->len; in ubifs_tnc_get_bu_keys()
1565 if (zbr->lnum != lnum || zbr->offs != offs) in ubifs_tnc_get_bu_keys()
1567 offs += ALIGN(zbr->len, 8); in ubifs_tnc_get_bu_keys()
1568 len = ALIGN(len, 8) + zbr->len; in ubifs_tnc_get_bu_keys()
1580 bu->zbranch[bu->cnt++] = *zbr; in ubifs_tnc_get_bu_keys()
1680 struct ubifs_zbranch *zbr) in validate_data_node() argument
1692 err = ubifs_check_node(c, buf, zbr->lnum, zbr->offs, 0, 0); in validate_data_node()
1699 if (len != zbr->len) { in validate_data_node()
1700 ubifs_err(c, "bad node length %d, expected %d", len, zbr->len); in validate_data_node()
1706 if (!keys_eq(c, &zbr->key, &key1)) { in validate_data_node()
1708 zbr->lnum, zbr->offs); in validate_data_node()
1709 dbg_tnck(&zbr->key, "looked for key "); in validate_data_node()
1719 ubifs_err(c, "bad node at LEB %d:%d", zbr->lnum, zbr->offs); in validate_data_node()
1907 const struct ubifs_zbranch *zbr, int n) in insert_zbranch() argument
1919 if (zbr->znode) in insert_zbranch()
1920 zbr->znode->iip = n; in insert_zbranch()
1925 znode->zbranch[n] = *zbr; in insert_zbranch()
1959 struct ubifs_zbranch *zbr, int n) in tnc_insert() argument
1963 union ubifs_key *key = &zbr->key, *key1; in tnc_insert()
1974 insert_zbranch(znode, zbr, n); in tnc_insert()
2056 zbr->znode->parent = zn; in tnc_insert()
2083 insert_zbranch(zi, zbr, n); in tnc_insert()
2094 zbr->key = zn->zbranch[0].key; in tnc_insert()
2095 zbr->znode = zn; in tnc_insert()
2096 zbr->lnum = 0; in tnc_insert()
2097 zbr->offs = 0; in tnc_insert()
2098 zbr->len = 0; in tnc_insert()
2160 struct ubifs_zbranch zbr; in ubifs_tnc_add() local
2162 zbr.znode = NULL; in ubifs_tnc_add()
2163 zbr.lnum = lnum; in ubifs_tnc_add()
2164 zbr.offs = offs; in ubifs_tnc_add()
2165 zbr.len = len; in ubifs_tnc_add()
2166 key_copy(c, key, &zbr.key); in ubifs_tnc_add()
2167 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add()
2169 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_add() local
2171 lnc_free(zbr); in ubifs_tnc_add()
2172 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add()
2173 zbr->lnum = lnum; in ubifs_tnc_add()
2174 zbr->offs = offs; in ubifs_tnc_add()
2175 zbr->len = len; in ubifs_tnc_add()
2215 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_replace() local
2218 if (zbr->lnum == old_lnum && zbr->offs == old_offs) { in ubifs_tnc_replace()
2219 lnc_free(zbr); in ubifs_tnc_replace()
2220 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_replace()
2223 zbr->lnum = lnum; in ubifs_tnc_replace()
2224 zbr->offs = offs; in ubifs_tnc_replace()
2225 zbr->len = len; in ubifs_tnc_replace()
2246 zbr = &znode->zbranch[n]; in ubifs_tnc_replace()
2247 lnc_free(zbr); in ubifs_tnc_replace()
2248 err = ubifs_add_dirt(c, zbr->lnum, in ubifs_tnc_replace()
2249 zbr->len); in ubifs_tnc_replace()
2252 zbr->lnum = lnum; in ubifs_tnc_replace()
2253 zbr->offs = offs; in ubifs_tnc_replace()
2254 zbr->len = len; in ubifs_tnc_replace()
2319 struct ubifs_zbranch *zbr = &znode->zbranch[n]; in ubifs_tnc_add_nm() local
2321 lnc_free(zbr); in ubifs_tnc_add_nm()
2322 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in ubifs_tnc_add_nm()
2323 zbr->lnum = lnum; in ubifs_tnc_add_nm()
2324 zbr->offs = offs; in ubifs_tnc_add_nm()
2325 zbr->len = len; in ubifs_tnc_add_nm()
2331 struct ubifs_zbranch zbr; in ubifs_tnc_add_nm() local
2333 zbr.znode = NULL; in ubifs_tnc_add_nm()
2334 zbr.lnum = lnum; in ubifs_tnc_add_nm()
2335 zbr.offs = offs; in ubifs_tnc_add_nm()
2336 zbr.len = len; in ubifs_tnc_add_nm()
2337 key_copy(c, key, &zbr.key); in ubifs_tnc_add_nm()
2338 err = tnc_insert(c, znode, &zbr, n + 1); in ubifs_tnc_add_nm()
2376 struct ubifs_zbranch *zbr; in tnc_delete() local
2385 zbr = &znode->zbranch[n]; in tnc_delete()
2386 lnc_free(zbr); in tnc_delete()
2388 err = ubifs_add_dirt(c, zbr->lnum, zbr->len); in tnc_delete()
2445 zbr = &znode->zbranch[0]; in tnc_delete()
2449 znode = dirty_cow_znode(c, zbr); in tnc_delete()
2460 c->zroot.lnum = zbr->lnum; in tnc_delete()
2461 c->zroot.offs = zbr->offs; in tnc_delete()
2462 c->zroot.len = zbr->len; in tnc_delete()
2756 struct ubifs_zbranch *zbr; in ubifs_tnc_next_ent() local
2799 zbr = &znode->zbranch[n]; in ubifs_tnc_next_ent()
2800 dent = kmalloc(zbr->len, GFP_NOFS); in ubifs_tnc_next_ent()
2810 dkey = &zbr->key; in ubifs_tnc_next_ent()
2817 err = tnc_read_node_nm(c, zbr, dent); in ubifs_tnc_next_ent()
3131 struct ubifs_zbranch *zbr; in is_leaf_node_in_tnc() local
3141 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3142 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()
3161 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3162 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()
3177 zbr = &znode->zbranch[n]; in is_leaf_node_in_tnc()
3178 if (lnum == zbr->lnum && offs == zbr->offs) in is_leaf_node_in_tnc()