From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] btrfs: Don't set SHAREABLE flag for data reloc tree
Date: Wed, 13 May 2020 16:01:58 +0200 [thread overview]
Message-ID: <20200513140157.GK18421@twin.jikos.cz> (raw)
In-Reply-To: <20200513061611.111807-3-wqu@suse.com>
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.
next prev parent reply other threads:[~2020-05-13 14:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 6:16 [PATCH 0/2] btrfs: REF_COWS bit rework Qu Wenruo
2020-05-13 6:16 ` [PATCH 1/2] btrfs: Rename BTRFS_ROOT_REF_COWS to BTRFS_ROOT_SHAREABLE Qu Wenruo
2020-05-13 14:18 ` David Sterba
2020-05-13 6:16 ` [PATCH 2/2] btrfs: Don't set SHAREABLE flag for data reloc tree Qu Wenruo
2020-05-13 6:44 ` Nikolay Borisov
2020-05-13 6:49 ` Qu Wenruo
2020-05-13 13:51 ` David Sterba
2020-05-14 0:01 ` Qu Wenruo
2020-05-13 14:01 ` David Sterba [this message]
2020-05-14 0:06 ` Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200513140157.GK18421@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox