• Lukas Czerner's avatar
    ext4: Add batched discard support for ext4 · 7360d173
    Lukas Czerner authored
    Walk through allocation groups and trim all free extents. It can be
    invoked through FITRIM ioctl on the file system. The main idea is to
    provide a way to trim the whole file system if needed, since some SSD's
    may suffer from performance loss after the whole device was filled (it
    does not mean that fs is full!).
    
    It search for free extents in allocation groups specified by Byte range
    start -> start+len. When the free extent is within this range, blocks
    are marked as used and then trimmed. Afterwards these blocks are marked
    as free in per-group bitmap.
    
    Since fstrim is a long operation it is good to have an ability to
    interrupt it by a signal. This was added by Dmitry Monakhov.
    Thanks Dimitry.
    Signed-off-by: default avatarLukas Czerner <lczerner@redhat.com>
    Signed-off-by: default avatarDmitry Monakhov <dmonakhov@openvz.org>
    Reviewed-by: default avatarJan Kara <jack@suse.cz>
    Reviewed-by: default avatarDmitry Monakhov <dmonakhov@openvz.org>
    Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
    7360d173
mballoc.c 132 KB