From: tytso@mit.edu
To: Wang Shilong <wangshilong1991@gmail.com>
Cc: linux-ext4@vger.kernel.org, Wang Shilong <wshilong@ddn.com>,
Shuichi Ihara <sihara@ddn.com>,
Andreas Dilger <adilger@dilger.ca>
Subject: Re: [PATCH v3 1/2] ext4: introduce EXT4_BG_WAS_TRIMMED to optimize trim
Date: Thu, 6 Aug 2020 00:47:03 -0400 [thread overview]
Message-ID: <20200806044703.GC7657@mit.edu> (raw)
In-Reply-To: <1592831677-13945-1-git-send-email-wangshilong1991@gmail.com>
On Mon, Jun 22, 2020 at 10:14:36PM +0900, Wang Shilong wrote:
> From: Wang Shilong <wshilong@ddn.com>
>
> Currently WAS_TRIMMED flag is not persistent, whenever filesystem was
> remounted, fstrim need walk all block groups again, the problem with
> this is FSTRIM could be slow on very large LUN SSD based filesystem.
>
> To avoid this kind of problem, we introduce a block group flag
> EXT4_BG_WAS_TRIMMED, the side effect of this is we need introduce
> extra one block group dirty write after trimming block group.
>
> And When clearing TRIMMED flag, block group will be journalled
> anyway, so it won't introduce any overhead.
This persistent flag will not be accurate if there are blocks that
were freed in the block group in the same transaction, before
EXT4_BG_WAS_TRIMMED flag is set.
That's because we can't trim (or reuse) a block which has been
released until the transaction has committed, since if we crash before
it is commited, the file unlink or truncate will not have happened,
and so we can't trash the block until after the deallocation has been
freed.
This problem is also there with a non-persistent flag, granted; but
when the file system is unmounted and remounted, we will eventually
trim the block via a fstrim. When we make the flag persistent, the
problem becomes worse, since it might mean that there are some blocks
that have been released, that might never get discarded.
I suppose the question is whether the sysadmin really wants unused
blocks to be discarded, either to not leak blocks in some kind of
thin-provisioned storage device, or if the sysadmin is depending on
the discard for some kind of security/privacy application (because
they know that a particular storage device actually has reliable,
secure discards), and how does that get balanced with sysadmins think
performance of fstrim is more important, especially if the device is
really slow at doing discard.
- Ted
next prev parent reply other threads:[~2020-08-06 11:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 13:14 [PATCH v3 1/2] ext4: introduce EXT4_BG_WAS_TRIMMED to optimize trim Wang Shilong
2020-06-22 13:14 ` [PATCH 2/2] ext4: avoid trimming block group if only few blocks freed Wang Shilong
2020-06-22 14:16 ` [PATCH v2 " Wang Shilong
2020-06-22 17:20 ` Andreas Dilger
2020-06-22 17:18 ` [PATCH v3 1/2] ext4: introduce EXT4_BG_WAS_TRIMMED to optimize trim Andreas Dilger
2020-08-06 4:47 ` tytso [this message]
2020-08-08 1:29 ` Wang Shilong
2020-08-08 15:18 ` tytso
2020-08-09 4:33 ` Andreas Dilger
2020-08-10 13:24 ` tytso
2020-08-12 23:14 ` Andreas Dilger
2020-08-14 8:06 ` Christoph Hellwig
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=20200806044703.GC7657@mit.edu \
--to=tytso@mit.edu \
--cc=adilger@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=sihara@ddn.com \
--cc=wangshilong1991@gmail.com \
--cc=wshilong@ddn.com \
/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;
as well as URLs for NNTP newsgroup(s).