Skip to content

Commit 5f9062a

Browse files
adam900710kdave
authored andcommitted
btrfs: qgroup: set a more sane default value for subtree drop threshold
Since commit 011b46c ("btrfs: skip subtree scan if it's too high to avoid low stall in btrfs_commit_transaction()"), btrfs qgroup can automatically skip large subtree scan at the cost of marking qgroup inconsistent. It's designed to address the final performance problem of snapshot drop with qgroup enabled, but to be safe the default value is BTRFS_MAX_LEVEL, requiring a user space daemon to set a different value to make it work. I'd say it's not a good idea to rely on user space tool to set this default value, especially when some operations (snapshot dropping) can be triggered immediately after mount, leaving a very small window to that that sysfs interface. So instead of disabling this new feature by default, enable it with a low threshold (3), so that large subvolume tree drop at mount time won't cause huge qgroup workload. CC: [email protected] # 6.1 Signed-off-by: Qu Wenruo <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 3510e68 commit 5f9062a

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

fs/btrfs/disk-io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,7 @@ static void btrfs_init_qgroup(struct btrfs_fs_info *fs_info)
19591959
fs_info->qgroup_seq = 1;
19601960
fs_info->qgroup_ulist = NULL;
19611961
fs_info->qgroup_rescan_running = false;
1962-
fs_info->qgroup_drop_subtree_thres = BTRFS_MAX_LEVEL;
1962+
fs_info->qgroup_drop_subtree_thres = BTRFS_QGROUP_DROP_SUBTREE_THRES_DEFAULT;
19631963
mutex_init(&fs_info->qgroup_rescan_lock);
19641964
}
19651965

fs/btrfs/qgroup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info)
14071407
fs_info->quota_root = NULL;
14081408
fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_ON;
14091409
fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE;
1410-
fs_info->qgroup_drop_subtree_thres = BTRFS_MAX_LEVEL;
1410+
fs_info->qgroup_drop_subtree_thres = BTRFS_QGROUP_DROP_SUBTREE_THRES_DEFAULT;
14111411
spin_unlock(&fs_info->qgroup_lock);
14121412

14131413
btrfs_free_qgroup_config(fs_info);

fs/btrfs/qgroup.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ struct btrfs_inode;
121121
#define BTRFS_QGROUP_RUNTIME_FLAG_CANCEL_RESCAN (1ULL << 63)
122122
#define BTRFS_QGROUP_RUNTIME_FLAG_NO_ACCOUNTING (1ULL << 62)
123123

124+
#define BTRFS_QGROUP_DROP_SUBTREE_THRES_DEFAULT (3)
125+
124126
/*
125127
* Record a dirty extent, and info qgroup to update quota on it
126128
*/

0 commit comments

Comments
 (0)