• Ritesh Harjani's avatar
    ext4: mballoc: refactor ext4_mb_good_group() · 8ef123fe
    Ritesh Harjani authored
    ext4_mb_good_group() definition was changed some time back
    and now it even initializes the buddy cache (via ext4_mb_init_group()),
    if in case the EXT4_MB_GRP_NEED_INIT() is true for a group.
    Note that ext4_mb_init_group() could sleep and so should not be called
    under a spinlock held.
    This is fine as of now because ext4_mb_good_group() is called before
    loading the buddy bitmap without ext4_lock_group() held
    and again called after loading the bitmap, only this time with
    ext4_lock_group() held.
    But still this whole thing is confusing.
    
    So this patch refactors out ext4_mb_good_group_nolock() which should be
    called when without holding ext4_lock_group().
    Also in further patches we hold the spinlock (ext4_lock_group()) while
    doing any calculations which involves grp->bb_free or grp->bb_fragments.
    Signed-off-by: default avatarRitesh Harjani <riteshh@linux.ibm.com>
    Link: https://lore.kernel.org/r/d9f7d031a5fbe1c943fae6bf1ff5cdf0604ae722.1589955723.git.riteshh@linux.ibm.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
    8ef123fe
mballoc.c 151 KB