• Andrew Morton's avatar
    [PATCH] ext2/3: better starting group for S_ISREG files · 1cdf4231
    Andrew Morton authored
    ext2 places non-directory objects into the same blockgroup as their
    directory, as long as that directory has free inodes.  It does this
    even if there are no free blocks in that blockgroup (!).
    
    This means that if there are lots of files being created at a common
    point in the tree, they _all_ have the same starting blockgroup.  For
    each file we do a big search forwards for the first block and the
    allocations end up getting intermingled.
    
    So this patch will avoid placing new inodes in block groups which have
    no free blocks.
    
    So far so good.  But this means that if a lot of new files are being
    created under a directory (or multiple directories) which are in the
    same blockgroup, all the new inodes will overflow into the same
    blockgroup.  No improvement at all.
    
    So the patch arranges for the new inode locations to be "spread out"
    across different blockgroups if they are not going to be placed in
    their directory's block group.  This is done by adding parent->i_ino
    into the starting point for the quadratic hash.  i_ino was chosen so
    that files which are in the same directory will tend to all land in the
    same new blockgroup.
    1cdf4231
ialloc.c 22.1 KB