diff mbox series

[7/7] btrfs: use btrfs_sb_metadata_uuid_or_null

Message ID 69a45acb12680df22a7c7052e788450e7f780d91.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
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/volumes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Sterba Aug. 11, 2023, 3:42 p.m. UTC | #1
On Mon, Jul 31, 2023 at 07:16:38PM +0800, Anand Jain wrote:
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/volumes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 661dc69543eb..316839d2aecc 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -821,7 +821,7 @@ static noinline struct btrfs_device *device_list_add(const char *path,
>  
>  	if (!fs_devices) {
>  		fs_devices = alloc_fs_devices(disk_super->fsid,
> -				has_metadata_uuid ? disk_super->metadata_uuid : NULL);
> +				btrfs_sb_metadata_uuid_or_null(disk_super));

This is the only place that passes a non-NULL pointer to
alloc_fs_devices, so it might be better to drop the 2nd argument
completely and just set the metadata_uuid here, which is basically
copying fsid to metadata_uuid.
Anand Jain Aug. 14, 2023, 3:32 p.m. UTC | #2
On 11/08/2023 23:42, David Sterba wrote:
> On Mon, Jul 31, 2023 at 07:16:38PM +0800, Anand Jain wrote:
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   fs/btrfs/volumes.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index 661dc69543eb..316839d2aecc 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -821,7 +821,7 @@ static noinline struct btrfs_device *device_list_add(const char *path,
>>   
>>   	if (!fs_devices) {
>>   		fs_devices = alloc_fs_devices(disk_super->fsid,
>> -				has_metadata_uuid ? disk_super->metadata_uuid : NULL);
>> +				btrfs_sb_metadata_uuid_or_null(disk_super));
> 
> This is the only place that passes a non-NULL pointer to
> alloc_fs_devices, so it might be better to drop the 2nd argument
> completely and just set the metadata_uuid here, which is basically
> copying fsid to metadata_uuid.

  Oh right. I am sending v2. Thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 661dc69543eb..316839d2aecc 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -821,7 +821,7 @@  static noinline struct btrfs_device *device_list_add(const char *path,
 
 	if (!fs_devices) {
 		fs_devices = alloc_fs_devices(disk_super->fsid,
-				has_metadata_uuid ? disk_super->metadata_uuid : NULL);
+				btrfs_sb_metadata_uuid_or_null(disk_super));
 		if (IS_ERR(fs_devices))
 			return ERR_CAST(fs_devices);