Re: fstrim is takes a long time on Btrfs and NVMe

Roman Mamedov
2019-12-22T19:23:51Z

On Sun, 22 Dec 2019 20:06:57 +0200
Nikolay Borisov <nborisov@suse.com> wrote:

> Well, if we rework how fitrim is implemented - e.g. make discards async
> and have some sort of locking to exclude queued extents being allocated
> we can alleviate the problem somewhat.

Please keep fstrim synchronous, in many cases TRIM is expected to be completed
as it returns, for the next step of making a snapshot of a thin LV for backup,
to shutdown a VM for migration, and so on.

I don't think many really care about how long fstrim takes, it's not a typical
interactive end-user task. By all means it's great to speed it up if possible,
but not via faking that with unexpected tricks of continuing to TRIM in the
background. Sure, SSDs already do that under the hood, but keep in mind that
SSDs are not the only application of TRIM (the other being as mentioned, thin
LVs and sparsely allocated disk images).

--
With respect,
Roman