lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 24 Sep 2010 17:35:56 +0200
From:	Lukas Czerner <>
Subject: [PATCH 0/3 v. 8] Ext3/Ext4 Batched discard support


since it has been a while from my last post, I have rebased patches to
cleanly apply to the newest kernel. Also there have been some changes
regarding blkdev_issue_discard() and its helpers, I have changed patches
to use the new helper (ext4_issue_discard() for ext4) and new format of
sb_issue_discard() (in ext3).

Also in order to give the user better control over the discard I have
changed FITRIM ioctl to return the exact amount of discarded Bytes, so
the user will know how much space has been reclaimed to wear-leveling.


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] directory
        -s Starting Byte to discard from
        -l Number of Bytes to discard from the start
        -m Minimum extent length to discard
        -v Verbose - prints out number of really discarded Bytes

a1edaf3 ext3: Add batched discard support
4ed7168 ext4: Add batched discard support
88f8c20 Add ioctl FITRIM.

 fs/ext3/balloc.c        |  251 +++++++++++++++++++++++++++++++++++++++++++++++
 fs/ext3/super.c         |    1 +
 fs/ext4/ext4.h          |    2 +
 fs/ext4/mballoc.c       |  191 +++++++++++++++++++++++++++++++++++
 fs/ext4/super.c         |    1 +
 fs/ioctl.c              |   39 +++++++
 include/linux/ext3_fs.h |    1 +
 include/linux/fs.h      |    2 +
 8 files changed, 488 insertions(+), 0 deletions(-)

To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to
More majordomo info at

Powered by blists - more mailing lists