diff mbox series

[2/7] btrfs: simplify memcpy either of metadata_uuid or fsid

Message ID 371de895b777e1805002a0703dbbd4fe5a5bf3f3.1690792823.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series metadata_uuid misc cleanup and fixes part2 | expand

Commit Message

Anand Jain July 31, 2023, 11:16 a.m. UTC
There is a helper which provides either metadata_uuid or fsid as per
METADATA_UUID flag. So use it.

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

Comments

Johannes Thumshirn Aug. 1, 2023, 1:19 p.m. UTC | #1
On 31.07.23 13:18, Anand Jain wrote:
> There is a helper which provides either metadata_uuid or fsid as per 
> METADATA_UUID flag. So use it.

Now that we have 'btrfs_sb_fsid_ptr()' use it to simplify metadata uuid 
copying in device_list_add()?

Code wise,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 2020b1fac764..2f470404ff83 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -841,15 +841,8 @@  static noinline struct btrfs_device *device_list_add(const char *path,
 		    found_transid > fs_devices->latest_generation) {
 			memcpy(fs_devices->fsid, disk_super->fsid,
 					BTRFS_FSID_SIZE);
-
-			if (has_metadata_uuid)
-				memcpy(fs_devices->metadata_uuid,
-				       disk_super->metadata_uuid,
-				       BTRFS_FSID_SIZE);
-			else
-				memcpy(fs_devices->metadata_uuid,
-				       disk_super->fsid, BTRFS_FSID_SIZE);
-
+			memcpy(fs_devices->metadata_uuid,
+			       btrfs_sb_fsid_ptr(disk_super), BTRFS_FSID_SIZE);
 			fs_devices->fsid_change = false;
 		}
 	}