[fstools, 0/4] Support discard in "block" and "swapon"

m.storchak at gmail.com m.storchak at gmail.com
Wed Jul 23 06:19:15 PDT 2025


From: Maxim Storchak <m.storchak at gmail.com>

SSD drives are quite common, and following their rules (discarding the unused 
blocks) can extend their life time. In addition, even if the device doesn't 
support discard, kernel can always "downgrade" the flags.

This patch series adds the "discard" option to block by extending the swap 
entries of fstab config with the discard parameter that provides full control 
over the discard feature.

swapon is another entry point for swap activation, so it gets an extra flag -d.

The implementation is inspired by busybox.


Maxim Storchak (4):
  fstools: block: define swap flags for block and swapon
  fstools: block: support discard in block
  fstools: block: add discard support to swapon
  fstools: block: enable discard in swapon -a

 block.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 54 insertions(+), 9 deletions(-)

-- 
2.50.0




More information about the openwrt-devel mailing list