Re: [PATCH 2/2] btrfs: Don't set SHAREABLE flag for data reloc tree
From: David Sterba <hidden>
Date: 2020-05-13 14:02:53
On Wed, May 13, 2020 at 02:16:11PM +0800, Qu Wenruo wrote:
- if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
+ if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID &&
+ root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID) {if (test_bit(BTRFS_ROOT_SHAREABLE, &root->state) || - root == fs_info->tree_root) + root == fs_info->tree_root || root == fs_info->dreloc_root)
if (found_extent &&
(test_bit(BTRFS_ROOT_SHAREABLE, &root->state) ||
- root == fs_info->tree_root)) {
+ root == fs_info->tree_root ||
+ root == fs_info->dreloc_root)) {Lots of repeated conditions, though not all of them exactly the same. I was thinking about adding some helpers but don't have a good suggestion. The concern is about too much special casing, it's eg tree_root + data_reloc_tree, or SHAREABLE + tree_reloc + data_reloc, etc. The helpers should capture the common semantics of the condition and also reduce the surface for future errors.