• L
    fs: Add FITRIM ioctl · 367a51a3
    Lukas Czerner 提交于
    Adds an filesystem independent ioctl to allow implementation of file
    system batched discard support. I takes fstrim_range structure as an
    argument. fstrim_range is definec in the include/fs.h and its
    definition is as follows.
    
    struct fstrim_range {
    	start;
    	len;
    	minlen;
    }
    
    start	- first Byte to trim
    len	- number of Bytes to trim from start
    minlen	- minimum extent length to trim, free extents shorter than this
    	  number of Bytes will be ignored. This will be rounded up to fs
    	  block size.
    
    It is also possible to specify NULL as an argument. In this case the
    arguments will set itself as follows:
    
    start = 0;
    len = ULLONG_MAX;
    minlen = 0;
    
    So it will trim the whole file system at one run.
    
    After the FITRIM is done, the number of actually discarded Bytes is stored
    in fstrim_range.len to give the user better insight on how much storage
    space has been really released for wear-leveling.
    Signed-off-by: NLukas Czerner <lczerner@redhat.com>
    Reviewed-by: NDmitry Monakhov <dmonakhov@openvz.org>
    Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
    367a51a3
fs.h 84.1 KB