23 dataoff = node->
tree->node_size - (rec + 2) * 2;
40 retval = node->
tree->max_key_len + 2;
42 retval = node->
tree->max_key_len + 1;
49 if (retval > node->
tree->max_key_len + 2) {
56 if (retval > node->
tree->max_key_len + 1) {
72 int idx_rec_off, data_rec_off, end_rec_off;
78 hfs_btree_inc_height(tree);
80 if (IS_ERR(fd->
bnode))
81 return PTR_ERR(fd->
bnode);
89 size = key_len + entry_len;
98 if (size > end_rec_off - end_off) {
100 panic(
"not enough room!\n");
101 new_node = hfs_bnode_split(fd);
102 if (IS_ERR(new_node))
103 return PTR_ERR(new_node);
108 mark_inode_dirty(tree->
inode);
115 data_rec_off = end_rec_off + 2;
116 idx_rec_off = tree->
node_size - (rec + 1) * 2;
117 if (idx_rec_off == data_rec_off)
124 }
while (data_rec_off < idx_rec_off);
139 if (!rec && new_node != node)
140 hfs_brec_update_parent(fd);
144 hfs_btree_inc_height(tree);
152 entry_len =
sizeof(cnid);
171 hfs_brec_update_parent(fd);
190 mark_inode_dirty(tree->
inode);
200 return PTR_ERR(parent);
209 if (rec_off == end_off)
217 }
while (rec_off >= end_off);
225 hfs_brec_update_parent(fd);
234 int num_recs, new_rec_off, new_off, old_rec_off;
240 if (IS_ERR(new_node))
256 if (IS_ERR(next_node)) {
267 if (data_start > size)
270 if (++num_recs < node->num_recs)
280 if (fd->
record + 1 < num_recs) {
290 fd->
bnode = new_node;
300 size = data_start - new_off;
302 data_end = data_start;
308 new_off = data_end -
size;
312 hfs_bnode_copy(new_node, 14, node, data_start, data_end - data_start);
340 mark_inode_dirty(tree->
inode);
355 int rec, rec_off, end_rec_off;
356 int start_off, end_off;
367 return PTR_ERR(parent);
379 rec_off = tree->
node_size - (rec + 2) * 2;
386 if (end_rec_off - end_off < diff) {
390 new_node = hfs_bnode_split(fd);
391 if (IS_ERR(new_node))
392 return PTR_ERR(new_node);
395 rec_off = tree->
node_size - (rec + 2) * 2;
404 while (rec_off > end_rec_off) {
410 end_off - start_off);
434 if (new_node == node)
448 static int hfs_btree_inc_height(
struct hfs_btree *tree)
459 return PTR_ERR(node);
462 if (IS_ERR(new_node)) {
464 return PTR_ERR(new_node);
506 key_size = (key_size + 1) & -2;
516 mark_inode_dirty(tree->
inode);