Lines Matching defs:znode

24  * @znode: previous znode
27 * Returns the next element or %NULL if @znode is already the last one.
31 struct ubifs_znode *znode)
38 if (unlikely(!znode))
41 if (unlikely(znode == zr)) {
42 if (znode->level == 0)
47 level = znode->level;
49 iip = znode->iip;
51 ubifs_assert(c, znode->level <= zr->level);
54 * First walk up until there is a znode with next branch to
57 while (znode->parent != zr && iip >= znode->parent->child_cnt) {
58 znode = znode->parent;
59 iip = znode->iip;
62 if (unlikely(znode->parent == zr &&
63 iip >= znode->parent->child_cnt)) {
68 * We were already looking for znode at lower
77 znode = ubifs_tnc_find_child(zr, 0);
78 ubifs_assert(c, znode);
82 zn = ubifs_tnc_find_child(znode->parent, iip + 1);
85 iip = znode->parent->child_cnt;
91 znode = zn;
98 iip = znode->iip;
111 * ubifs_search_zbranch - search znode branch.
113 * @znode: znode to search in
115 * @n: znode branch slot number is returned here
117 * This is a helper function which search branch with key @key in @znode using
122 * closest branch is returned in @n; the slot if all keys in this znode are
126 const struct ubifs_znode *znode,
129 int beg = 0, end = znode->child_cnt, mid;
131 const struct ubifs_zbranch *zbr = &znode->zbranch[0];
151 ubifs_assert(c, *n >= -1 && *n < znode->child_cnt);
156 if (*n + 1 < znode->child_cnt)
163 * ubifs_tnc_postorder_first - find first znode to do postorder tree traversal.
164 * @znode: znode to start at (root of the sub-tree to traverse)
166 * Find the lowest leftmost znode in a subtree of the TNC tree. The LNC is
169 struct ubifs_znode *ubifs_tnc_postorder_first(struct ubifs_znode *znode)
171 if (unlikely(!znode))
174 while (znode->level > 0) {
177 child = ubifs_tnc_find_child(znode, 0);
179 return znode;
180 znode = child;
183 return znode;
189 * @znode: previous znode
192 * Returns the next element or %NULL if @znode is already the last one.
195 struct ubifs_znode *znode)
199 ubifs_assert(c, znode);
200 if (unlikely(!znode->parent))
204 zn = ubifs_tnc_find_child(znode->parent, znode->iip + 1);
207 return znode->parent;
209 /* Go to the first znode in this new subtree */
216 * @znode: znode defining subtree to destroy
222 struct ubifs_znode *znode)
224 struct ubifs_znode *zn = ubifs_tnc_postorder_first(znode);
231 if (!zn->zbranch[n].znode)
235 !ubifs_zn_dirty(zn->zbranch[n].znode))
239 kfree(zn->zbranch[n].znode);
242 if (zn == znode) {
254 * read_znode - read an indexing node from flash and fill znode.
257 * @znode: znode to read to
259 * This function reads an indexing node from the flash media and fills znode
266 struct ubifs_znode *znode)
291 znode->child_cnt = le16_to_cpu(idx->child_cnt);
292 znode->level = le16_to_cpu(idx->level);
295 lnum, offs, znode->level, znode->child_cnt);
297 if (znode->child_cnt > c->fanout || znode->level > UBIFS_MAX_LEVELS) {
299 c->fanout, znode->child_cnt);
300 ubifs_err(c, "max levels %d, znode level %d",
301 UBIFS_MAX_LEVELS, znode->level);
306 for (i = 0; i < znode->child_cnt; i++) {
308 struct ubifs_zbranch *zbr = &znode->zbranch[i];
315 zbr->znode = NULL;
340 if (znode->level)
368 for (i = 0; i < znode->child_cnt - 1; i++) {
371 key1 = &znode->zbranch[i].key;
372 key2 = &znode->zbranch[i + 1].key;
399 * ubifs_load_znode - load znode to TNC cache.
401 * @zbr: znode branch
402 * @parent: znode's parent
405 * This function loads znode pointed to by @zbr into the TNC cache and
414 struct ubifs_znode *znode;
416 ubifs_assert(c, !zbr->znode);
418 * A slab cache is not presently used for znodes because the znode size
421 znode = kzalloc(c->max_znode_sz, GFP_NOFS);
422 if (!znode)
425 err = read_znode(c, zbr, znode);
432 * Increment the global clean znode counter as well. It is OK that
433 * global and per-FS clean znode counters may be inconsistent for some
439 zbr->znode = znode;
440 znode->parent = parent;
441 znode->time = ktime_get_seconds();
442 znode->iip = iip;
444 return znode;
447 kfree(znode);