linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 1/2] btrfs: fix parent in memory total_devices after seed delete
@ 2018-07-03  5:12 Anand Jain
  2018-07-03  5:12 ` [PATCH 2/2] btrfs: fix missing superblock update in the device delete commit transaction Anand Jain
  0 siblings, 1 reply; 6+ messages in thread
From: Anand Jain @ 2018-07-03  5:12 UTC (permalink / raw)
  To: linux-btrfs

In case of deleting the seed device the %cur_devices (seed)
and the %fs_devices (parent) are different. Now, as the parent
fs_devices::total_devices also maintains the total number of devices
including the seed device, so decrement its in-memory value for the
successful seed delete. We are already updating its corresponding on-disk
btrfs_super_block::number_devices value.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/volumes.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 5bd6f3a40f9c..6b807b166ca3 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2027,6 +2027,9 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
 
 	cur_devices->num_devices--;
 	cur_devices->total_devices--;
+	/* Update total_devices for the parent fs_devices if its seed */
+	if (cur_devices != fs_devices)
+		fs_devices->total_devices--;
 
 	if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state))
 		cur_devices->missing_devices--;
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH 1/2] btrfs: fix parent in memory total_devices after seed delete
@ 2018-05-31  7:35 Anand Jain
  2018-05-31  7:35 ` [PATCH 2/2] btrfs: fix missing superblock update in the device delete commit transaction Anand Jain
  0 siblings, 1 reply; 6+ messages in thread
From: Anand Jain @ 2018-05-31  7:35 UTC (permalink / raw)
  To: linux-btrfs

If in case of deleting the seed device the %cur_devices (seed)
and the %fs_devices (parent) are different. Now, as the parent
fs_devices::total_devices also maintains the total number of devices
including the seed device, so decrement its in memory value for the
successful seed delete as we do update its corresponding
btrfs_super_block::number_devices.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/volumes.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index d3f9efbef9a9..5296f26be2f6 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2047,6 +2047,9 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
 
 	cur_devices->num_devices--;
 	cur_devices->total_devices--;
+	/* Update total_devices for the parent fs_devices if its seed */
+	if (cur_devices != fs_devices)
+		fs_devices->total_devices--;
 
 	if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state))
 		cur_devices->missing_devices--;
-- 
2.7.0


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

end of thread, other threads:[~2018-07-03  9:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-03  5:12 [PATCH RESEND 1/2] btrfs: fix parent in memory total_devices after seed delete Anand Jain
2018-07-03  5:12 ` [PATCH 2/2] btrfs: fix missing superblock update in the device delete commit transaction Anand Jain
2018-07-03  5:56   ` Nikolay Borisov
2018-07-03  9:07     ` Anand Jain
2018-07-03  9:07       ` Nikolay Borisov
  -- strict thread matches above, loose matches on Subject: below --
2018-05-31  7:35 [PATCH 1/2] btrfs: fix parent in memory total_devices after seed delete Anand Jain
2018-05-31  7:35 ` [PATCH 2/2] btrfs: fix missing superblock update in the device delete commit transaction 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).