From: Luca Stefani <luca.stefani.ge1@gmail.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: Don't block system suspend during fstrim
Date: Mon, 2 Sep 2024 13:10:47 +0200 [thread overview]
Message-ID: <2e15214b-7e95-4e64-a899-725de12c9037@gmail.com> (raw)
In-Reply-To: <e4903dac-cfd6-4513-b7ae-7f64c80fc8b6@gmx.com>
On 02/09/24 13:01, Qu Wenruo wrote:
>
>
> 在 2024/9/2 18:47, Qu Wenruo 写道:
> [...]
>> Forgot to mention that, even for error case, we should copy the
>> fstrim_range structure to the ioctl parameter to indicate any progress
>> we made.
>
> Sorry to bother you again, I should have notice it earlier.
>
> There is another possible cause of the huge delay for freezing, that's
> the blkdev_issue_discard() calls inside btrfs_issue_discard() itself.
>
> The problem here is, we can have a very large disk, e.g. 8TiB device,
> mostly empty.
>
> In that case, although we will do the split according to our super block
> locations, the last super block ends at 256G, we can submit a huge
> discard for the range [256G, 8T), causing a super large delay.
>
> So the proper way here is to limit the size of each discard (e.g. limit
> it to 1GiB, just as the chunk stripe size limit), and do the check after
> each 1GiB discard.
>
> So this may be a larger problem than we thought.
>
> I would recommend to split the fix into the following parts:
>
> - Simple small fixes
> Like always update the fstrim_range structure, no matter the return
> value.
Sure, that's already done. Will upload separately.
>
> - Proper discard size split and new freezing checks
I'll try to do the first part, and fallback to the mailing list for help
in case of failure, thanks.
>
> Thanks,
> Qu
>>
>> Thanks,
>> Qu
>>>
>>> Just please update the commit message to explicitly mention that, we
>>> have a free extent discarding phase, which can trim a lot of unallocated
>>> space, and there is no limits on the trim size (unlike the block group
>>> part).
>>>
>>> Thanks,
>>> Qu
>>>>
>>>> Thanks,
>>>> Qu
>>>>
>>>> >> }
>>>> >> mutex_unlock(&fs_devices->device_list_mutex);
>>>> >
>>>>
>>>
next prev parent reply other threads:[~2024-09-02 11:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 16:48 [PATCH] btrfs: Don't block system suspend during fstrim Luca Stefani
2024-09-02 8:32 ` Luca Stefani
2024-09-02 8:49 ` Qu Wenruo
[not found] ` <CAO0HQ0X3zk6aau50Ew2nmNP-pwNEkmgAoC2Ewmi30sGi7uQwDA@mail.gmail.com>
2024-09-02 9:12 ` Qu Wenruo
2024-09-02 9:17 ` Qu Wenruo
2024-09-02 9:31 ` Luca Stefani
2024-09-02 9:40 ` Qu Wenruo
2024-09-02 11:01 ` Qu Wenruo
2024-09-02 11:10 ` Luca Stefani [this message]
2024-09-02 9:14 ` Luca Stefani
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=2e15214b-7e95-4e64-a899-725de12c9037@gmail.com \
--to=luca.stefani.ge1@gmail.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.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