diff mbox series

[-next] btrfs: convert to use super_set_uuid to support for FS_IOC_GETFSUUID

Message ID 20240624063835.2476169-1-huangxiaojia2@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] btrfs: convert to use super_set_uuid to support for FS_IOC_GETFSUUID | expand

Commit Message

Huang Xiaojia June 24, 2024, 6:38 a.m. UTC
FS_IOC_GETFSUUID ioctl exposes the uuid of a filesystem. To support
the ioctl, init sb->s_uuid with super_set_uuid().

Signed-off-by: Huang Xiaojia <huangxiaojia2@huawei.com>
---
 fs/btrfs/disk-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Sterba June 24, 2024, 3:49 p.m. UTC | #1
On Mon, Jun 24, 2024 at 02:38:35PM +0800, Huang Xiaojia wrote:
> FS_IOC_GETFSUUID ioctl exposes the uuid of a filesystem. To support
> the ioctl, init sb->s_uuid with super_set_uuid().
> 
> Signed-off-by: Huang Xiaojia <huangxiaojia2@huawei.com>
> ---
>  fs/btrfs/disk-io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 38cdb8875e8e..e5235dbf9016 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -3369,7 +3369,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
>  	/* Update the values for the current filesystem. */
>  	sb->s_blocksize = sectorsize;
>  	sb->s_blocksize_bits = blksize_bits(sectorsize);
> -	memcpy(&sb->s_uuid, fs_info->fs_devices->fsid, BTRFS_FSID_SIZE);
> +	super_set_uuid(sb, (void *)fs_info->fs_devices->fsid, BTRFS_FSID_SIZE);

How does this work when the metadat_uuid is set?
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 38cdb8875e8e..e5235dbf9016 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3369,7 +3369,7 @@  int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
 	/* Update the values for the current filesystem. */
 	sb->s_blocksize = sectorsize;
 	sb->s_blocksize_bits = blksize_bits(sectorsize);
-	memcpy(&sb->s_uuid, fs_info->fs_devices->fsid, BTRFS_FSID_SIZE);
+	super_set_uuid(sb, (void *)fs_info->fs_devices->fsid, BTRFS_FSID_SIZE);
 
 	mutex_lock(&fs_info->chunk_mutex);
 	ret = btrfs_read_sys_array(fs_info);