extent_state_t ex_state; /* see state flags below */
struct extent_tree_node *next; /* for bcnt extent lists */
+ struct extent_tree_node *last; /* for bcnt extent list anchors */
#if 0
xfs_ino_t ex_inode; /* owner, NULL if free or */
/* multiply allocated */
new->ex_blockcount = new_blockcount;
new->ex_state = new_state;
new->next = NULL;
+ new->last = NULL;
return(new);
}
/*
* avl tree code doesn't handle dups so insert
* onto linked list in increasing startblock order
+ *
+ * when called from mk_incore_fstree,
+ * startblock is in increasing order.
+ * current is an "anchor" node.
+ * quick check if the new ext goes to the end.
+ * if so, append at the end, using the last field
+ * of the "anchor".
+ */
+ ASSERT(current->last != NULL);
+ if (startblock > current->last->ex_startblock) {
+ current->last->next = ext;
+ current->last = ext;
+ return;
+ }
+
+ /*
+ * scan, to find the proper location for new entry.
+ * this scan is *very* expensive and gets worse with
+ * with increasing entries.
*/
top = prev = current;
while (current != NULL &&
if (top == current) {
ASSERT(top == prev);
/*
+ * new entry should be ahead of current.
+ * to keep the avl tree intact,
* swap the values of to-be-inserted element
* and the values of the head of the list.
* then insert as the 2nd element on the list.
do_error(_(": duplicate bno extent range\n"));
}
+ ext->last = ext; /* ext is an "anchor" node */
+
return;
}