Lines Matching defs:orphan

13  * An orphan is an inode number whose inode node has been committed to the index
22 * The orphan area is a fixed number of LEBs situated between the LPT area and
23 * the main area. The number of orphan area LEBs is specified when the file
24 * system is created. The minimum number is 1. The size of the orphan area
36 * when the inode is deleted. Any new orphans that are in the orphan tree when
37 * the commit is run, are written to the orphan area in 1 or more orphan nodes.
38 * If the orphan area is full, it is consolidated to make space. There is
48 struct ubifs_orphan *orphan, *o;
51 orphan = kzalloc(sizeof(struct ubifs_orphan), GFP_NOFS);
52 if (!orphan)
54 orphan->inum = inum;
55 orphan->new = 1;
56 INIT_LIST_HEAD(&orphan->child_list);
61 kfree(orphan);
75 kfree(orphan);
81 rb_link_node(&orphan->rb, parent, p);
82 rb_insert_color(&orphan->rb, &c->orph_tree);
83 list_add_tail(&orphan->list, &c->orph_list);
84 list_add_tail(&orphan->new_list, &c->orph_new);
87 list_add_tail(&orphan->child_list,
93 return orphan;
148 * ubifs_add_orphan - add an orphan.
150 * @inum: orphan inode number
152 * Add an orphan. This function is called when an inodes link count drops to
163 struct ubifs_orphan *orphan;
165 orphan = orphan_add(c, inum, NULL);
166 if (IS_ERR(orphan))
167 return PTR_ERR(orphan);
184 xattr_orphan = orphan_add(c, xattr_inum, orphan);
201 * ubifs_delete_orphan - delete an orphan.
203 * @inum: orphan inode number
205 * Delete an orphan. This function is called when an inode is deleted.
216 ubifs_err(c, "missing orphan ino %lu", (unsigned long)inum);
240 struct ubifs_orphan *orphan, **last;
244 list_for_each_entry(orphan, &c->orph_new, new_list) {
245 ubifs_assert(c, orphan->new);
246 ubifs_assert(c, !orphan->cmt);
247 orphan->new = 0;
248 orphan->cmt = 1;
249 *last = orphan;
250 last = &orphan->cnext;
303 * do_write_orph_node - write a node to the orphan head.
308 * This function writes a node to the orphan head from the orphan buffer. If
335 * write_orph_node - write an orphan node.
339 * This function builds an orphan node from the cnext list and writes it to the
340 * orphan head. On success, %0 is returned, otherwise a negative error code
345 struct ubifs_orphan *orphan, *cnext;
360 ubifs_err(c, "out of space in orphan area");
374 orphan = cnext;
375 ubifs_assert(c, orphan->cmt);
376 orph->inos[i] = cpu_to_le64(orphan->inum);
377 orphan->cmt = 0;
378 cnext = orphan->cnext;
379 orphan->cnext = NULL;
399 * write_orph_nodes - write orphan nodes until there are no more to commit.
403 * This function writes orphan nodes for all the orphans to commit. On success,
429 * consolidate - consolidate the orphan area.
447 struct ubifs_orphan *orphan, **last;
452 list_for_each_entry(orphan, &c->orph_list, list) {
453 if (orphan->new)
455 orphan->cmt = 1;
456 *last = orphan;
457 last = &orphan->cnext;
470 ubifs_err(c, "out of space in orphan area");
512 struct ubifs_orphan *orphan, *dnext;
517 orphan = dnext;
518 dnext = orphan->dnext;
519 ubifs_assert(c, !orphan->new);
520 ubifs_assert(c, orphan->del);
521 rb_erase(&orphan->rb, &c->orph_tree);
522 list_del(&orphan->list);
524 dbg_gen("deleting orphan ino %lu", (unsigned long)orphan->inum);
525 kfree(orphan);
574 * insert_dead_orphan - insert an orphan.
576 * @inum: orphan inode number
578 * This function is a helper to the 'do_kill_orphans()' function. The orphan
584 struct ubifs_orphan *orphan, *o;
587 orphan = kzalloc(sizeof(struct ubifs_orphan), GFP_KERNEL);
588 if (!orphan)
590 orphan->inum = inum;
602 kfree(orphan);
607 rb_link_node(&orphan->rb, parent, p);
608 rb_insert_color(&orphan->rb, &c->orph_tree);
609 list_add_tail(&orphan->list, &c->orph_list);
610 orphan->del = 1;
611 orphan->dnext = c->orph_dnext;
612 c->orph_dnext = orphan;
619 * do_kill_orphans - remove orphan inodes from the index.
622 * @last_cmt_no: cmt_no of last orphan node read is passed and returned here
624 * @last_flagged: whether the end orphan node is encountered
627 * every orphan node in a LEB and for every inode number recorded, removes
647 ubifs_err(c, "invalid node type %d in orphan area at %d:%d",
662 * row, the commit number written on orphan nodes will continue
671 * The last orphan node had a higher commit number and
673 * number. That makes this orphan node, out of date.
676 ubifs_err(c, "out of order commit number %llu in orphan node at %d:%d",
745 * kill_orphans - remove all orphan inodes from the index.
748 * If recovery is required, then orphan inodes recorded during the previous
751 * the next commit, the LEBs where the orphan information is recorded are not
769 * but may contain out of date orphan nodes if the unmap didn't go
770 * through. In addition, the last orphan node written for each commit is
772 * there are orphan nodes from the next commit (i.e. the commit did not
807 * ubifs_mount_orphans - delete orphan inodes and erase LEBs that recorded them.
867 struct check_orphan *orphan, *o;
870 orphan = kzalloc(sizeof(struct check_orphan), GFP_NOFS);
871 if (!orphan)
873 orphan->inum = inum;
884 kfree(orphan);
888 rb_link_node(&orphan->rb, parent, p);
889 rb_insert_color(&orphan->rb, root);
930 ubifs_err(c, "found orphan node ino %lu, type %d",
940 /* Must be recorded as an orphan */
943 ubifs_err(c, "missing orphan, ino %lu",
1039 ubifs_err(c, "%lu missing orphan(s)", ci.missing);