Message ID | cover.1716386100.git.fdmanana@suse.com (mailing list archive) |
---|---|
Headers | show |
Series | btrfs: avoid some unnecessary commit of empty transactions | expand |
On Wed, May 22, 2024 at 03:36:28PM +0100, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > A few places can unnecessarily create an empty transaction and then commit > it, when the goal is just to catch the current transaction and wait for > its commit to complete. This results in wasting IO, time and rotation of > the precious backup roots in the super block. Details in the change logs. > The patches are all independent, except patch 4 that applies on top of > patch 3 (but could have been done in any order really, they are independent). Reviewed-by: Josef Bacik <josef@toxicpanda.com> Thanks, Josef
在 2024/5/23 00:06, fdmanana@kernel.org 写道: > From: Filipe Manana <fdmanana@suse.com> > > A few places can unnecessarily create an empty transaction and then commit > it, when the goal is just to catch the current transaction and wait for > its commit to complete. This results in wasting IO, time and rotation of > the precious backup roots in the super block. Details in the change logs. > The patches are all independent, except patch 4 that applies on top of > patch 3 (but could have been done in any order really, they are independent). Looks good to me. Reviewed-by: Qu Wenruo <wqu@suse.com> Have you considered outputting a warning if we're committing an empty transaction (for debug build)? That would prevent such problem from happening again. Thanks, Qu > > Filipe Manana (7): > btrfs: qgroup: avoid start/commit empty transaction when flushing reservations > btrfs: avoid create and commit empty transaction when committing super > btrfs: send: make ensure_commit_roots_uptodate() simpler and more efficient > btrfs: send: avoid create/commit empty transaction at ensure_commit_roots_uptodate() > btrfs: scrub: avoid create/commit empty transaction at finish_extent_writes_for_zoned() > btrfs: add and use helper to commit the current transaction > btrfs: send: get rid of the label and gotos at ensure_commit_roots_uptodate() > > fs/btrfs/disk-io.c | 8 +------- > fs/btrfs/qgroup.c | 31 +++++-------------------------- > fs/btrfs/scrub.c | 6 +----- > fs/btrfs/send.c | 32 ++++++++------------------------ > fs/btrfs/space-info.c | 9 +-------- > fs/btrfs/super.c | 11 +---------- > fs/btrfs/transaction.c | 19 +++++++++++++++++++ > fs/btrfs/transaction.h | 1 + > 8 files changed, 37 insertions(+), 80 deletions(-) >
On Wed, May 22, 2024 at 11:21 PM Qu Wenruo <quwenruo.btrfs@gmx.com> wrote: > > > > 在 2024/5/23 00:06, fdmanana@kernel.org 写道: > > From: Filipe Manana <fdmanana@suse.com> > > > > A few places can unnecessarily create an empty transaction and then commit > > it, when the goal is just to catch the current transaction and wait for > > its commit to complete. This results in wasting IO, time and rotation of > > the precious backup roots in the super block. Details in the change logs. > > The patches are all independent, except patch 4 that applies on top of > > patch 3 (but could have been done in any order really, they are independent). > > Looks good to me. > > Reviewed-by: Qu Wenruo <wqu@suse.com> > > Have you considered outputting a warning if we're committing an empty > transaction (for debug build)? > > That would prevent such problem from happening again. It's not really a bug, just inefficient behaviour with side effects for this particular type of use case. An empty transaction can happen in other in other scenarios too like: btrfs_start_transaction() do something that fails, call btrfs_end_transaction() and return error to user space In that case no transaction abort happens since we haven't modified anything, and if no one else uses that transaction until it's committed, it's an "empty" transaction. So the warning is not feasible. Thanks. > > Thanks, > Qu > > > > Filipe Manana (7): > > btrfs: qgroup: avoid start/commit empty transaction when flushing reservations > > btrfs: avoid create and commit empty transaction when committing super > > btrfs: send: make ensure_commit_roots_uptodate() simpler and more efficient > > btrfs: send: avoid create/commit empty transaction at ensure_commit_roots_uptodate() > > btrfs: scrub: avoid create/commit empty transaction at finish_extent_writes_for_zoned() > > btrfs: add and use helper to commit the current transaction > > btrfs: send: get rid of the label and gotos at ensure_commit_roots_uptodate() > > > > fs/btrfs/disk-io.c | 8 +------- > > fs/btrfs/qgroup.c | 31 +++++-------------------------- > > fs/btrfs/scrub.c | 6 +----- > > fs/btrfs/send.c | 32 ++++++++------------------------ > > fs/btrfs/space-info.c | 9 +-------- > > fs/btrfs/super.c | 11 +---------- > > fs/btrfs/transaction.c | 19 +++++++++++++++++++ > > fs/btrfs/transaction.h | 1 + > > 8 files changed, 37 insertions(+), 80 deletions(-) > >
On Wed, May 22, 2024 at 03:36:28PM +0100, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > A few places can unnecessarily create an empty transaction and then commit > it, when the goal is just to catch the current transaction and wait for > its commit to complete. This results in wasting IO, time and rotation of > the precious backup roots in the super block. Details in the change logs. > The patches are all independent, except patch 4 that applies on top of > patch 3 (but could have been done in any order really, they are independent). > > Filipe Manana (7): > btrfs: qgroup: avoid start/commit empty transaction when flushing reservations > btrfs: avoid create and commit empty transaction when committing super > btrfs: send: make ensure_commit_roots_uptodate() simpler and more efficient > btrfs: send: avoid create/commit empty transaction at ensure_commit_roots_uptodate() > btrfs: scrub: avoid create/commit empty transaction at finish_extent_writes_for_zoned() > btrfs: add and use helper to commit the current transaction > btrfs: send: get rid of the label and gotos at ensure_commit_roots_uptodate() Reviewed-by: David Sterba <dsterba@suse.com>
From: Filipe Manana <fdmanana@suse.com> A few places can unnecessarily create an empty transaction and then commit it, when the goal is just to catch the current transaction and wait for its commit to complete. This results in wasting IO, time and rotation of the precious backup roots in the super block. Details in the change logs. The patches are all independent, except patch 4 that applies on top of patch 3 (but could have been done in any order really, they are independent). Filipe Manana (7): btrfs: qgroup: avoid start/commit empty transaction when flushing reservations btrfs: avoid create and commit empty transaction when committing super btrfs: send: make ensure_commit_roots_uptodate() simpler and more efficient btrfs: send: avoid create/commit empty transaction at ensure_commit_roots_uptodate() btrfs: scrub: avoid create/commit empty transaction at finish_extent_writes_for_zoned() btrfs: add and use helper to commit the current transaction btrfs: send: get rid of the label and gotos at ensure_commit_roots_uptodate() fs/btrfs/disk-io.c | 8 +------- fs/btrfs/qgroup.c | 31 +++++-------------------------- fs/btrfs/scrub.c | 6 +----- fs/btrfs/send.c | 32 ++++++++------------------------ fs/btrfs/space-info.c | 9 +-------- fs/btrfs/super.c | 11 +---------- fs/btrfs/transaction.c | 19 +++++++++++++++++++ fs/btrfs/transaction.h | 1 + 8 files changed, 37 insertions(+), 80 deletions(-)