From: David Sterba <dsterba@suse.cz>
To: Josef Bacik <josef@toxicpanda.com>
Cc: 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: Thu, 1 Feb 2024 20:18:12 +0100 [thread overview]
Message-ID: <20240201191811.GX31555@twin.jikos.cz> (raw)
In-Reply-To: <20240131204800.GB3203388@perftesting>
On Wed, Jan 31, 2024 at 03:48:00PM -0500, Josef Bacik wrote:
> On Wed, Jan 31, 2024 at 11:49:28PM +0800, Anand Jain wrote:
> > This cleanup patch reuses the main file descriptor (fd1) in open_ctree(),
> > and with this change both the test cases (with partition and without
> > partition) now runs fine.
> >
> > I've done an initial tests only, not validated with the multi-device mkfs.
> > More cleanup is possible but pending feedback; marking this patch as an RFC.
>
> I'd like to see the cleaned up version of this patch, but I have a few comments.
>
> 1) I think re-using the fd is reasonable, tho could this just be reworked to
> create the temp-sb and write this to all the devs, close the file
> descriptors, and then call open_ctree?
This would trigger the udev unnecessarily and could let other processes
to eg. try to mount the device (like systemd did or maybe still does).
This could fail the second open_ctree. That it's all done with one fd
open reduces possible interactions that could be problematic.
> 2) I hate adding another thing into a core file that we'll have to figure out
> how to undo later as we sync more code from the kernel into btrfs-progs, I'm
> not sure if there's a way around this, but thinking harder about adding
> something to disk-io.c that is for userspace only would be good.
Yeah the open_ctree functions in progs are misplaced in disk-io.c and
are there for historical reasons. We'd need separate file (or maybe
whole compat directory) but for now let it be there, the cleanup is
going to be big.
next prev parent reply other threads:[~2024-02-01 19:18 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
2024-02-01 19:18 ` David Sterba [this message]
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=20240201191811.GX31555@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=anand.jain@oracle.com \
--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