From: Nikolay Borisov <nborisov@suse.com>
To: Chris Murphy <lists@colorremedies.com>, Roman Mamedov <rm@romanrm.net>
Cc: Josef Bacik <josef@toxicpanda.com>,
Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: fstrim is takes a long time on Btrfs and NVMe
Date: Mon, 23 Dec 2019 00:29:17 +0200 [thread overview]
Message-ID: <347063a8-d0d9-4fa9-564c-17f7e01121cb@suse.com> (raw)
In-Reply-To: <CAJCQCtSDxOa29cTNgr_cpJ5vT0boKRz2+nHLv2oUHiWYrGpkag@mail.gmail.com>
On 23.12.19 г. 0:11 ч., Chris Murphy wrote:
> On Sun, Dec 22, 2019 at 12:15 PM Roman Mamedov <rm@romanrm.net> wrote:
>>
>> 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.
>
> XFS already does async discards. What's the effect of FIFREEZE on
> discards? An LV snapshot freezes the file system on the LV just prior
> to the snapshot.
Actually, XFS issues synchronous discards for the FITRIM ioctl i.e
xfs_trim_extents calls blkdev_issue_discard same as with BTRFS. And
Dennis' patches implement async runtime discards (which is what XFS is
using by default).
>
>> I don't think many really care about how long fstrim takes, it's not a typical
>> interactive end-user task.
>
> I only care if I notice it affecting user space (excepting my timed
> use of fstrim for testing).
>
> Speculation: If a scheduled fstrim can block startup, that's not OK. I
> don't have enough data to know if it's possible, let alone likely. But
> when fstrim takes a minute to discard the unused blocks in only 51GiB
> of used block groups (likely highly fragmented free space), and only a
> fraction of a second to discard the unused block *groups*, I'm
> suspicious startup delays may be possible.
If it takes that long then it's the drive's implementaiton at fault.
Whatever we do in software we will only masking the latency, which might
be workable solution for some but not for others.
>
> Found this, from 2019 LSFMM
> https://lwn.net/Articles/787272/
>
>
>
next prev parent reply other threads:[~2019-12-22 22:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-21 6:24 fstrim is takes a long time on Btrfs and NVMe Chris Murphy
2019-12-21 8:38 ` Andrea Gelmini
2019-12-21 9:27 ` Nikolay Borisov
2019-12-22 3:43 ` Chris Murphy
2019-12-22 3:59 ` Chris Murphy
2019-12-22 10:40 ` Nikolay Borisov
2019-12-22 17:43 ` Josef Bacik
2019-12-22 17:49 ` Nikolay Borisov
2019-12-22 18:00 ` Josef Bacik
2019-12-22 18:06 ` Nikolay Borisov
2019-12-22 19:08 ` Chris Murphy
2019-12-22 19:15 ` Roman Mamedov
2019-12-22 22:11 ` Chris Murphy
2019-12-22 22:29 ` Nikolay Borisov [this message]
2019-12-22 23:14 ` Chris Murphy
2019-12-22 23:23 ` Chris Murphy
2019-12-22 18:50 ` Chris Murphy
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=347063a8-d0d9-4fa9-564c-17f7e01121cb@suse.com \
--to=nborisov@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=lists@colorremedies.com \
--cc=rm@romanrm.net \
/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