linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Misc volume patch set part2
@ 2018-08-10  5:53 Anand Jain
  2018-08-10  5:53 ` [PATCH v4 1/3] btrfs: drop uuid_mutex in btrfs_free_extra_devids() Anand Jain
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Anand Jain @ 2018-08-10  5:53 UTC (permalink / raw)
  To: linux-btrfs

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-08-16  5:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-10  5:53 [PATCH v2 0/3] Misc volume patch set part2 Anand Jain
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

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).