• Chris Mason's avatar
    Btrfs: be more selective in the defrag ioctl · 940100a4
    Chris Mason authored
    The btrfs defrag ioctl had some bugs around delalloc accounting, and it
    wasn't properly skipping pages that were not in the mapping.
    
    It wasn't properly clearing the page checked flag, which could make the
    writeback code ignore the page forever while pinning it as dirty.
    
    This commit fixes those problems and makes defrag a little smarter.  It
    skips holes and it doesn't waste time defragging large extents.  If a
    tiny extent comes before a very large extent, it will defrag both of
    them to make sure the tiny extent ends up next to something big.
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    940100a4
ioctl.c 44.1 KB