- iam_ptr_t new_blknr)
-{
- struct lvar_leaf_entry *first_to_move;
- struct lvar_leaf_entry *last_to_stay;
- struct iam_path *path;
- struct lvar_leaf_header *hdr;
- struct buffer_head *new_leaf;
-
- ptrdiff_t tomove;
- lvar_hash_t hash;
-
- assert_inv(n_invariant(leaf));
- assert_corr(iam_leaf_is_locked(leaf));
-
- new_leaf = *bh;
- path = iam_leaf_path(leaf);
-
- hdr = (void *)new_leaf->b_data;
-
- first_to_move = find_pivot(leaf, &last_to_stay);
- assert_corr(last_to_stay != NULL);
- assert_corr(e_next(leaf, last_to_stay) == first_to_move);
-
- hash = e_hash(first_to_move);
- if (hash == e_hash(last_to_stay))
- /*
- * Duplicate hash.
- */
- hash |= 1;
-
- tomove = PDIFF(n_end(leaf), first_to_move);
- memmove(hdr + 1, first_to_move, tomove);
-
- h_used_adj(leaf, hdr, tomove);
- h_used_adj(leaf, n_head(leaf), -tomove);
-
- assert_corr(n_end(leaf) == first_to_move);
-
- if (n_cur(leaf) >= first_to_move) {
- /*
- * insertion point moves into new leaf.
- */
- ptrdiff_t shift;
- int result;
-
- shift = PDIFF(leaf->il_at, first_to_move);
- *bh = leaf->il_bh;
- leaf->il_bh = new_leaf;
- leaf->il_curidx = new_blknr;
-
- assert_corr(iam_leaf_is_locked(leaf));
- result = lvar_init(leaf);
- /*
- * init cannot fail, as node was just initialized.
- */
- assert_corr(result == 0);
- leaf->il_at = ((void *)leaf->il_at) + shift;
- }
- /*
- * Insert pointer to the new node (together with the least key in
- * the node) into index node.
- */
- iam_insert_key_lock(path, path->ip_frame, (struct iam_ikey *)&hash,
- new_blknr);
- assert_corr(n_cur(leaf) < n_end(leaf));
- assert_inv(n_invariant(leaf));
+ iam_ptr_t new_blknr)
+{
+ struct lvar_leaf_entry *first_to_move;
+ struct lvar_leaf_entry *last_to_stay;
+ struct iam_path *path;
+ struct lvar_leaf_header *hdr;
+ struct buffer_head *new_leaf;
+ ptrdiff_t tomove;
+ lvar_hash_t hash;
+
+ assert_inv(n_invariant(leaf));
+ assert_corr(iam_leaf_is_locked(leaf));
+
+ new_leaf = *bh;
+ path = iam_leaf_path(leaf);
+
+ hdr = (void *)new_leaf->b_data;
+
+ first_to_move = find_pivot(leaf, &last_to_stay);
+ assert_corr(last_to_stay != NULL);
+ assert_corr(e_next(leaf, last_to_stay) == first_to_move);
+
+ hash = e_hash(first_to_move);
+ if (hash == e_hash(last_to_stay))
+ /*
+ * Duplicate hash.
+ */
+ hash |= 1;
+
+ tomove = PDIFF(n_end(leaf), first_to_move);
+ memmove(hdr + 1, first_to_move, tomove);
+
+ h_used_adj(leaf, hdr, tomove);
+ h_used_adj(leaf, n_head(leaf), -tomove);
+
+ assert_corr(n_end(leaf) == first_to_move);
+
+ if (n_cur(leaf) >= first_to_move) {
+ /*
+ * insertion point moves into new leaf.
+ */
+ ptrdiff_t shift;
+
+ shift = PDIFF(leaf->il_at, first_to_move);
+ *bh = leaf->il_bh;
+ leaf->il_bh = new_leaf;
+ leaf->il_curidx = new_blknr;
+
+ assert_corr(iam_leaf_is_locked(leaf));
+ lvar_init(leaf);
+ /*
+ * init cannot fail, as node was just initialized.
+ */
+ assert_corr(result == 0);
+ leaf->il_at = ((void *)leaf->il_at) + shift;
+ }
+ /*
+ * Insert pointer to the new node (together with the least key in
+ * the node) into index node.
+ */
+ iam_insert_key_lock(path, path->ip_frame, (struct iam_ikey *)&hash,
+ new_blknr);
+ assert_corr(n_cur(leaf) < n_end(leaf));
+ assert_inv(n_invariant(leaf));