diff mbox series

[1/4] btrfs: Call find_fsid from find_fsid_inprogress

Message ID 20200110121135.7386-2-nborisov@suse.com (mailing list archive)
State New, archived
Headers show
Series More split-brain fixes for metadata uuid feature | expand

Commit Message

Nikolay Borisov Jan. 10, 2020, 12:11 p.m. UTC
From: Su Yue <Damenly_Su@gmx.com>

Since find_fsid_inprogress should also handle the case in which an fs
didn't change its FSID make it call find_fsid directly. This makes the
code in device_list_add simpler by eliminating a conditional call of
find_fsid. No functional changes.

Signed-off-by: Su Yue <Damenly_Su@gmx.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/volumes.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

--
2.17.1

Comments

Josef Bacik Jan. 10, 2020, 3:24 p.m. UTC | #1
On 1/10/20 7:11 AM, Nikolay Borisov wrote:
> From: Su Yue <Damenly_Su@gmx.com>
> 
> Since find_fsid_inprogress should also handle the case in which an fs
> didn't change its FSID make it call find_fsid directly. This makes the
> code in device_list_add simpler by eliminating a conditional call of
> find_fsid. No functional changes.
> 
> Signed-off-by: Su Yue <Damenly_Su@gmx.com>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index fa48589bd924..0bac8a31edff 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -671,7 +671,9 @@  static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices,

 /*
  * Handle scanned device having its CHANGING_FSID_V2 flag set and the fs_devices
- * being created with a disk that has already completed its fsid change.
+ * being created with a disk that has already completed its fsid change. Such
+ * disk can belong to an fs which has its FSID changed or to one which doesn't.
+ * Handle both cases here.
  */
 static struct btrfs_fs_devices *find_fsid_inprogress(
 					struct btrfs_super_block *disk_super)
@@ -687,7 +689,7 @@  static struct btrfs_fs_devices *find_fsid_inprogress(
 		}
 	}

-	return NULL;
+	return find_fsid(disk_super->fsid, NULL);
 }


@@ -736,19 +738,10 @@  static noinline struct btrfs_device *device_list_add(const char *path,
 					BTRFS_SUPER_FLAG_CHANGING_FSID_V2);

 	if (fsid_change_in_progress) {
-		if (!has_metadata_uuid) {
-			/*
-			 * When we have an image which has CHANGING_FSID_V2 set
-			 * it might belong to either a filesystem which has
-			 * disks with completed fsid change or it might belong
-			 * to fs with no UUID changes in effect, handle both.
-			 */
+		if (!has_metadata_uuid)
 			fs_devices = find_fsid_inprogress(disk_super);
-			if (!fs_devices)
-				fs_devices = find_fsid(disk_super->fsid, NULL);
-		} else {
+		else
 			fs_devices = find_fsid_changed(disk_super);
-		}
 	} else if (has_metadata_uuid) {
 		fs_devices = find_fsid(disk_super->fsid,
 				       disk_super->metadata_uuid);