Skip to content
  • Steven Whitehouse's avatar
    [GFS2] Reverse block order in build_height · e90c01e1
    Steven Whitehouse authored
    
    
    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: default avatarSteven Whitehouse <swhiteho@redhat.com>
    e90c01e1