Hi, just some minor changes here. As Andreas pointed out it is better to have special structure to pass FITRIM arguments into ioctl, instead os just an array of "noname" elements. So I have introduced this structure: struct fstrim_range { uint64_t start; uint64_t len; uint64_t minlen; }; Also the tool which uses FSTRIM ioctl gets updated. SHORT DESCRIPTION: ================== Batched discard adds ability to discard free space on mounded filesystem, in order to avoid using current discard implementation which discards recently freed blocks. This approach may on some devices (it depends on how efficient is the device wear-leveling algorithm) result in huge performance loss. Batched discard can be invoked from user-space through FITRIM ioctl on the whole, or just a part, of file system. With this approach we are searching for continuous free blocks bigger than defined through ioctl to discard them. So, since we are searching for big continuous extents it is much more efficient than current approach and it gives user fine grained control over how much disk space will be reclaimed for wear-leveling and what impact will it have on performance. I have attached source code for example application which uses FITRIM to discard just a part or whole filesystem. Since FITRIM is filesystem independent ioctl it can be used by any filesystem which supports it. Usage: fstrim [-s start] [-l length] [-m minimum-extent] [-v] {mountpoint} -s Starting Byte to discard from -l Number of Bytes to discard from the start -m Minimum extent length to discard -v Verbose - number of discarded bytes --- bd6a5a3 ext3: Add batched discard support for ext3 9dcabb2 ext4: Add batched discard support for ext4 9c8c3a5 Add ioctl FITRIM. 787dbea ext4: Use return value from sb_issue_discard() fs/ext3/balloc.c | 256 +++++++++++++++++++++++++++++++++++++++++++++++ fs/ext3/super.c | 1 + fs/ext4/ext4.h | 2 + fs/ext4/mballoc.c | 194 +++++++++++++++++++++++++++++++++++- fs/ext4/super.c | 1 + fs/ioctl.c | 39 +++++++ include/linux/ext3_fs.h | 1 + include/linux/fs.h | 8 ++ 8 files changed, 501 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html