Skip to content

Commit fdef89c

Browse files
fdmananakdave
authored andcommitted
btrfs: avoid starting new transaction when cleaning qgroup during subvolume drop
At btrfs_qgroup_cleanup_dropped_subvolume() all we want to commit the current transaction in order to have all the qgroup rfer/excl numbers up to date. However we are using btrfs_start_transaction(), which joins the current transaction if there is one that is not yet committing, but also starts a new one if there is none or if the current one is already committing (its state is >= TRANS_STATE_COMMIT_START). This later case results in unnecessary IO, wasting time and a pointless rotation of the backup roots in the super block. So instead of using btrfs_start_transaction() followed by a btrfs_commit_transaction(), use btrfs_commit_current_transaction() which achieves our purpose and avoids starting and committing new transactions. Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent e2f0943 commit fdef89c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

fs/btrfs/qgroup.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,11 +1880,7 @@ int btrfs_qgroup_cleanup_dropped_subvolume(struct btrfs_fs_info *fs_info, u64 su
18801880
* Commit current transaction to make sure all the rfer/excl numbers
18811881
* get updated.
18821882
*/
1883-
trans = btrfs_start_transaction(fs_info->quota_root, 0);
1884-
if (IS_ERR(trans))
1885-
return PTR_ERR(trans);
1886-
1887-
ret = btrfs_commit_transaction(trans);
1883+
ret = btrfs_commit_current_transaction(fs_info->quota_root);
18881884
if (ret < 0)
18891885
return ret;
18901886

0 commit comments

Comments
 (0)