public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz, Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Josef Bacik <josef@toxicpanda.com>,
	Anand Jain <anand.jain@oracle.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH RFC] btrfs-progs: mkfs: optimize file descriptor usage in mkfs.btrfs
Date: Fri, 2 Feb 2024 07:20:58 +1030	[thread overview]
Message-ID: <b0f17f2e-5993-42a0-9a57-e93a2a90c020@gmx.com> (raw)
In-Reply-To: <20240201190712.GW31555@twin.jikos.cz>



On 2024/2/2 05:37, David Sterba wrote:
> On Thu, Feb 01, 2024 at 07:19:15PM +1030, Qu Wenruo wrote:
>> The problem is, even if we change the sequence, it doesn't make much
>> difference.
>>
>> There are several things involved, and most of them are out of our control:
>>
>> - The udev scan is triggered on writable fd close().
>> - The udev scan is always executed on the parent block device
>>     Not the partition device.
>> - The udev scan the whole disk, not just the partition
>>
>> With those involved, changing the nested behavior would not change anything.
>>
>> The write in another partition of the same parent block device can still
>> triggered a scan meanwhile we're making fs on our partition.
>
> So this means that creating ext4 on /dev/sda1 and btrfs on /dev/sda2 can
> trigger the udev events? And when both mkfs utilities would lock the
> device then running them concurrently will fail, right? This could
> happen in installation tools that can create different filesystems at
> the same time.

For ext4, I didn't see any direct flock call, maybe they are using some
helpers to do the same work but I'm not 100% sure.

>
> I wonder if we should add options to assert, skip locking or wait until
> it's free.
> The "udevadm lock" has various options to do that.
I'm pretty sure we can add options like --wait to implement the same
deadline behavior for mkfs.btrfs.

Thanks,
Qu

  reply	other threads:[~2024-02-01 20:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 15:49 [PATCH RFC] btrfs-progs: mkfs: optimize file descriptor usage in mkfs.btrfs Anand Jain
2024-01-31 20:48 ` Josef Bacik
2024-02-01  8:49   ` Qu Wenruo
2024-02-01 19:07     ` David Sterba
2024-02-01 20:50       ` Qu Wenruo [this message]
2024-02-01 19:18   ` David Sterba
2024-02-02  1:52     ` Anand Jain
2024-02-01 21:59   ` Qu Wenruo

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=b0f17f2e-5993-42a0-9a57-e93a2a90c020@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --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