OSDN Git Service

libext2fs: Teach extent.c how to split nodes
authorEric Sandeen <sandeen@redhat.com>
Tue, 20 May 2008 15:14:20 +0000 (10:14 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 2 Jun 2008 14:13:59 +0000 (10:13 -0400)
commit9fd6a96d9bf089d8d0ece3bba23b0ef19d03c102
tree2700a85c4f12153da277e05e8e40a7eb7c2bc5ec
parentaa8e2f1c31374bfc6e479aea008896d179b100b4
libext2fs: Teach extent.c how to split nodes

When called for a given handle, the new function extent_node_split()
will split the current node such that half of the node's entries will
be moved to a new tree block.  The parent will then be updated to
point to the (now smaller) original node as well as the new node.

If the root node is requested to be split, it will move all
entries out to a new node, and leave a single entry in the
root pointing to that new node.

If the reqested split node's parent is full it will recursively
split up to the root to make room for the new node's insertion.

If you ask to split a non-root node with only one entry,
it will refuse (we'd have an empty node otherwise).

It also updates the i_blocks count when a new block has
successfully been connected to the tree.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/ext2_err.et.in
lib/ext2fs/extent.c
lib/ext2fs/extent_dbg.ct