[GFS2] Reverse block order in build_height
authorSteven Whitehouse <swhiteho@redhat.com>
Fri, 12 May 2006 16:09:15 +0000 (12:09 -0400)
committerSteven Whitehouse <swhiteho@redhat.com>
Fri, 12 May 2006 16:09:15 +0000 (12:09 -0400)
commite90c01e148b967d30caf59e76accb3a58ca6b74b
tree92f9b45febbdbc52174307e2e73dbb26aa893465
parent7d63b54a65ce902f9aaa8efe8192aa3b983264d4
[GFS2] Reverse block order in build_height

The original code ordered the blocks allocated in the build_height
routine backwards causing excessive disk seeks during a read of the
metadata. This patch reverses the order to try and reduce disk seeks.

Example: A five level metadata tree, I = Inode, P = Pointers, D = Data

You need to read the blocks in the order:

I P5 P4 P3 P2 P1 D

in order to read a single data block. The new code now orders the blocks
in this way. The old code used to order them as:

I P1 P2 P3 P4 P5 D

requiring two extra seeks on average. Note that for files which are
grown by gradual extension rather than by truncate or by llseek/write
at a large offset, this doesn't apply. In the case of writing to a
file linearly, this routine will only be called upon to extend the
height of the tree by one block at a time, so the ordering is
determined by when its called rather than by the internals of the
routine itself. Optimising that part of the ordering is a much
harder problem.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/bmap.c