From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Filipe Manana <fdmanana@kernel.org>,
Christoph Hellwig <hch@infradead.org>,
fstests@vger.kernel.org, linux-btrfs@vger.kernel.org,
Filipe Manana <fdmanana@suse.com>
Subject: Re: [PATCH] generic: test swap activation on file that used to have clones
Date: Thu, 19 Dec 2024 06:49:01 +1030 [thread overview]
Message-ID: <d4c1334e-0275-453c-bdea-7878dc8c56f1@gmx.com> (raw)
In-Reply-To: <20241218200927.GC6160@frogsfrogsfrogs>
在 2024/12/19 06:39, Darrick J. Wong 写道:
> On Wed, Dec 18, 2024 at 09:07:26AM +1030, Qu Wenruo wrote:
>>
>>
>> 在 2024/12/18 03:52, Darrick J. Wong 写道:
>>> On Tue, Dec 17, 2024 at 08:26:33AM +0000, Filipe Manana wrote:
>>>> On Tue, Dec 17, 2024 at 8:14 AM Christoph Hellwig <hch@infradead.org> wrote:
>>>>>
>>>>> On Wed, Dec 11, 2024 at 03:09:40PM +0000, fdmanana@kernel.org wrote:
>>>>>> The test also fails sporadically on xfs and the bug was already reported
>>>>>> to the xfs mailing list:
>>>>>>
>>>>>> https://lore.kernel.org/linux-xfs/CAL3q7H7cURmnkJfUUx44HM3q=xKmqHb80eRdisErD_x8rU4+0Q@mail.gmail.com/
>>>>>>
>>>>>
>>>>> This version still doesn't seem to have the fs freeze/unfreeze that Darrick
>>>>> asked for in that thread.
>>>>
>>>> I don't get it, what's the freeze/unfreeze for? Where should they be placed?
>>>> Is it some way to get around the bug on xfs?
>>>
>>> freeze kicks the background inode gc thread so that the unlinked clones
>>> actually get freed before the swapon call. A less bighammer idea might
>>> be to call XFS_IOC_FREE_EOFBLOCKS which also kicks the garbage
>>> collectors.
>>
>> I'm wondering why this GC things can not be done inside XFS' swapon call?
>>
>> So that we don't need some per-fs workaround in a generic test case.
>
> I suppose one could call xfs_inodegc_flush from within swapon with the
> swap file's i_rwsem held, but now we're blocking swapon while we wait
> for some unbounded number of probably unrelated unlinked inodes to be
> freed on the off chance that one of them shared blocks.
>
> A better answer might be to run FALLOC_FL_UNSHARE on the file, but now
> we're making swapon more complex and potentially issuing a lot of IO to
> make that happen. If you can convince the fsdevel/mm folks that swapon
> is supposed to try to correct things it doesn't like in the file mapping
> (instead of returning EINVAL or whatever it does now) then we could add
> that to the syscall definition.
Sorry that I'm no familiar with XFS to provide any help, but the swapon
call on btrfs is already very complex.
It needs to verify every extent of that file is not shared, and block
the subvolume from being snapshotted.
(The extent shareness check iteslf may already cause quite some IO)
So at least to me, a little more extra logic and IO shouldn't be a huge
blockage, since we're already doing exactly that since the btrfs
swapfile support.
Thanks,
Qu
>
> --D
>
>> Thanks,
>> Qu
>>>
>>> --D
>>>
>>
>>
>
next prev parent reply other threads:[~2024-12-18 20:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 15:09 [PATCH] generic: test swap activation on file that used to have clones fdmanana
2024-12-17 8:14 ` Christoph Hellwig
2024-12-17 8:26 ` Filipe Manana
2024-12-17 17:22 ` Darrick J. Wong
2024-12-17 17:41 ` Filipe Manana
2024-12-17 22:37 ` Qu Wenruo
2024-12-18 20:09 ` Darrick J. Wong
2024-12-18 20:19 ` Qu Wenruo [this message]
2025-01-13 12:00 ` Filipe Manana
2025-01-13 13:24 ` Zorro Lang
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=d4c1334e-0275-453c-bdea-7878dc8c56f1@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=djwong@kernel.org \
--cc=fdmanana@kernel.org \
--cc=fdmanana@suse.com \
--cc=fstests@vger.kernel.org \
--cc=hch@infradead.org \
--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