public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 0/5] Ioctl to clear unused space in various ways
Date: Fri, 28 Feb 2025 15:49:20 +0100	[thread overview]
Message-ID: <cover.1740753608.git.dsterba@suse.com> (raw)

Add ioctl that is similar to FITRIM and in addition to trim can do also
zeroing (either plain overwrite, or unmap the blocks if the device
supports it) and secure erase.

This can be used to zero the unused space in e.g. VM images (when run
from inside the guest, if fstrim is not supported) or free space on
thin-provisioned devices.

The secure erase is provided by blkdiscard command but I'm not aware of
equivalent that can be run on a filesystem, so this is for parity.

David Sterba (5):
  btrfs: extend trim callchains to pass the operation type
  btrfs: add new ioctl CLEAR_FREE
  btrfs: add zeroout mode to CLEAR_FREE ioctl
  btrfs: add secure erase mode to CLEAR_FREE ioctl
  btrfs: add more zeroout modes to CLEAR_FREE ioctl

 fs/btrfs/discard.c          |   4 +-
 fs/btrfs/extent-tree.c      | 159 +++++++++++++++++++++++++++++++-----
 fs/btrfs/extent-tree.h      |   5 +-
 fs/btrfs/free-space-cache.c |  29 ++++---
 fs/btrfs/free-space-cache.h |   8 +-
 fs/btrfs/inode.c            |   2 +-
 fs/btrfs/ioctl.c            |  42 ++++++++++
 fs/btrfs/volumes.c          |   3 +-
 include/uapi/linux/btrfs.h  |  46 +++++++++++
 9 files changed, 258 insertions(+), 40 deletions(-)

-- 
2.47.1


             reply	other threads:[~2025-02-28 14:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 14:49 David Sterba [this message]
2025-02-28 14:49 ` [PATCH 1/5] btrfs: extend trim callchains to pass the operation type David Sterba
2025-02-28 14:49 ` [PATCH 2/5] btrfs: add new ioctl CLEAR_FREE David Sterba
2025-03-01  3:19   ` Sun YangKai
2025-03-03  8:43     ` David Sterba
2025-03-03  8:47   ` David Sterba
2025-03-10 16:38   ` Johannes Thumshirn
2025-03-10 20:18     ` David Sterba
2025-03-11  0:11     ` Damien Le Moal
2025-03-11 18:39       ` David Sterba
2025-02-28 14:49 ` [PATCH 3/5] btrfs: add zeroout mode to CLEAR_FREE ioctl David Sterba
2025-02-28 14:49 ` [PATCH 4/5] btrfs: add secure erase " David Sterba
2025-02-28 14:49 ` [PATCH 5/5] btrfs: add more zeroout modes " David Sterba
2025-03-05 11:01 ` [PATCH 0/5] Ioctl to clear unused space in various ways David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1740753608.git.dsterba@suse.com \
    --to=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox