Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

btrfs: remove pointless code when creating and deleting a subvolume

When creating and deleting a subvolume, after starting a transaction we
are explicitly calling btrfs_record_root_in_trans() for the root which we
passed to btrfs_start_transaction(). This is pointless because at
transaction.c:start_transaction() we end up doing that call, regardless
of whether we actually start a new transaction or join an existing one,
and if we were not it would mean the root item of that root would not
be updated in the root tree when committing the transaction, leading to
problems easy to spot with fstests for example.

Remove these redundant calls. They were introduced with commit
74e97958121a ("btrfs: qgroup: fix qgroup prealloc rsv leak in subvolume
operations").

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Filipe Manana and committed by
David Sterba
ebc7c767 6d81df75

-8
-5
fs/btrfs/inode.c
··· 4552 4552 ret = PTR_ERR(trans); 4553 4553 goto out_release; 4554 4554 } 4555 - ret = btrfs_record_root_in_trans(trans, root); 4556 - if (ret) { 4557 - btrfs_abort_transaction(trans, ret); 4558 - goto out_end_trans; 4559 - } 4560 4555 btrfs_qgroup_convert_reserved_meta(root, qgroup_reserved); 4561 4556 qgroup_reserved = 0; 4562 4557 trans->block_rsv = &block_rsv;
-3
fs/btrfs/ioctl.c
··· 658 658 ret = PTR_ERR(trans); 659 659 goto out_release_rsv; 660 660 } 661 - ret = btrfs_record_root_in_trans(trans, BTRFS_I(dir)->root); 662 - if (ret) 663 - goto out; 664 661 btrfs_qgroup_convert_reserved_meta(root, qgroup_reserved); 665 662 qgroup_reserved = 0; 666 663 trans->block_rsv = &block_rsv;