From: Josef Bacik <josef@toxicpanda.com>
To: fdmanana@kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: avoid transaction commit on any fsync after subvolume creation
Date: Tue, 11 Jun 2024 12:48:52 -0400 [thread overview]
Message-ID: <20240611164852.GB247672@perftesting> (raw)
In-Reply-To: <65a8b2e10dc470b52858865906f36c80b77ce010.1718104115.git.fdmanana@suse.com>
On Tue, Jun 11, 2024 at 12:10:24PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> As of commit 1b53e51a4a8f ("btrfs: don't commit transaction for every
> subvol create") we started to make any fsync after creating a subvolume
> to fallback to a transaction commit if the fsync is performed in the
> same transaction that was used to create the subvolume. This happens
> with the following at ioctl.c:create_subvol():
>
> $ cat fs/btrfs/ioctl.c
> (...)
> /* Tree log can't currently deal with an inode which is a new root. */
> btrfs_set_log_full_commit(trans);
> (...)
>
> Note that the comment is misleading as the problem is not that fsync can
> not deal with the root inode of a new root, but that we can not log any
> inode that belongs to a root that was not yet persisted because that would
> make log replay fail since the root doesn't exist at log replay time.
>
> The above simply makes any fsync fallback to a full transaction commit if
> it happens in the same transaction used to create the subvolume - even if
> it's an inode that belongs to any other subvolume. This is a brute force
> solution and it doesn't necessarily improve performance for every workload
> out there - it just moves a full transaction commit from one place, the
> subvolume creation, to another - an fsync for any inode.
>
> Just improve on this by making the fallback to a transacton commit only
> for an fsync against an inode of the new subvolume, or for the directory
> that contains the dentry that points to the new subvolume (in case anyone
> attempts to fsync the directory in the same transaction).
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Thanks,
Josef
prev parent reply other threads:[~2024-06-11 16:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 11:10 [PATCH] btrfs: avoid transaction commit on any fsync after subvolume creation fdmanana
2024-06-11 16:48 ` Josef Bacik [this message]
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=20240611164852.GB247672@perftesting \
--to=josef@toxicpanda.com \
--cc=fdmanana@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.