From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 0/3] Misc volume patch set part2
Date: Fri, 10 Aug 2018 13:53:18 +0800 [thread overview]
Message-ID: <20180810055321.19730-1-anand.jain@oracle.com> (raw)
The patch set (2/3 and 3/3) adds helper function to deduce the num_device
(which is the number of the devices when device is mounted, this excludes
the seed device however includes the replacing target). We need to know
the num_device that actually belongs to the FSID without the replacing
target (if it exists) when we are balancing and or when we are trying to
device delete. In both of these cases, it would be wrong to consider
replacing target when reallocating the blockgroups.
This patch as such does not change any of the logic which is already in
the original code, but instead it would bring such a logic at two
locations into a single place/function. But to do that as these two
location uses either WARN_ON or BUG_ON to perform the safety catch so
the first patch does the cleanup and uses ASSERT at both of these
places. And now since these two sections of codes are identical, the 2nd
patch replaces them into a helper function.
Also though the check for num_device > 0 should actually be num_device >
1 OR instead, the check of num_device > 0 should have been after the
num_device--, since we have had already too many comments and added
confusions, I shall leave that part to be fixed at sometime later. So
that the cleanup here is a really a cleanup instead of chaning the
logic in a rough scale.
Last but not least, this patch has gone through a lot of comments on
either to use BUG or return -EINVAL for accidental fall of num_device
below 1, which I wasn't expecting so much of the concerns about
the use of BUG_ON/-EINVAL as its trivial because fundamentally a FS
can't be in the mounted state when num_device < 1.
Anand Jain (3):
btrfs: drop uuid_mutex in btrfs_free_extra_devids()
btrfs: assert for num_devices below 0
btrfs: add helper btrfs_num_devices() to deduce num_devices
fs/btrfs/volumes.c | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
--
2.7.0
next reply other threads:[~2018-08-10 8:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-10 5:53 Anand Jain [this message]
2018-08-10 5:53 ` [PATCH v4 1/3] btrfs: drop uuid_mutex in btrfs_free_extra_devids() Anand Jain
2018-08-10 5:53 ` [PATCH 1/2] btrfs: assert for num_devices below 0 Anand Jain
2018-08-10 10:46 ` David Sterba
2018-08-15 12:11 ` David Sterba
2018-08-16 2:09 ` Anand Jain
2018-08-10 5:53 ` [PATCH v5 2/2] btrfs: add helper btrfs_num_devices() to deduce num_devices Anand Jain
2018-08-10 10:45 ` David Sterba
2018-08-15 12:20 ` [PATCH v2 0/3] Misc volume patch set part2 David Sterba
2018-08-16 2:59 ` Anand Jain
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=20180810055321.19730-1-anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).