Skip to contentSkip to conversation

btrfs: use super_set_uuid to support FS_IOC_GETFSUUID

PATCH In review Alexander Mikhalitsyn 2 participants 3 messages Nov 24 – Nov 25 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: use super_set_uuid to support FS_IOC_GETFSUUID

Currently, FS_IOC_GETFSUUID fails with ENOTTY. To fix that we should use super_set_uuid() as other filesystems do.

---
 fs/btrfs/disk-io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/disk-io.c +2 -2
index d8d433ac458b..fde9f4c4ea11 100644
@@ -3616,9 +3616,9 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
 	 * on-disk UUID directly from the super_copy.
 	 */
 	if (fs_info->fs_devices->temp_fsid)
-		memcpy(&sb->s_uuid, fs_info->super_copy->fsid, BTRFS_FSID_SIZE);
+		super_set_uuid(sb, fs_info->super_copy->fsid, BTRFS_FSID_SIZE);
 	else
-		memcpy(&sb->s_uuid, fs_info->fs_devices->fsid, BTRFS_FSID_SIZE);
+		super_set_uuid(sb, fs_info->fs_devices->fsid, BTRFS_FSID_SIZE);
 
 	mutex_lock(&fs_info->chunk_mutex);
 	ret = btrfs_read_sys_array(fs_info);
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Alexander Mikhalitsyn

Currently, FS_IOC_GETFSUUID fails with ENOTTY. To fix that we should use super_set_uuid() as other filesystems do.

Will push it for for-next if no other review.

Thanks,
Qu

Quoted 20 lines
---
  fs/btrfs/disk-io.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/disk-io.c +2 -2
index d8d433ac458b..fde9f4c4ea11 100644
@@ -3616,9 +3616,9 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
  	 * on-disk UUID directly from the super_copy.
  	 */
  	if (fs_info->fs_devices->temp_fsid)
-		memcpy(&sb->s_uuid, fs_info->super_copy->fsid, BTRFS_FSID_SIZE);
+		super_set_uuid(sb, fs_info->super_copy->fsid, BTRFS_FSID_SIZE);
  	else
-		memcpy(&sb->s_uuid, fs_info->fs_devices->fsid, BTRFS_FSID_SIZE);
+		super_set_uuid(sb, fs_info->fs_devices->fsid, BTRFS_FSID_SIZE);
 
  	mutex_lock(&fs_info->chunk_mutex);
  	ret = btrfs_read_sys_array(fs_info);
#2 lore raw
Quoted 9 lines · Qu Wenruo
Quoted 5 lines · Alexander Mikhalitsyn

Currently, FS_IOC_GETFSUUID fails with ENOTTY. To fix that we should use super_set_uuid() as other filesystems do.

Dear Qu,

Quoted 4 lines

Will push it for for-next if no other review.

thank you very much for such a fast review ;-)

Kind regards,
Alex

Quoted 25 lines

Thanks,
Qu

Quoted 20 lines
---
  fs/btrfs/disk-io.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/disk-io.c +2 -2
index d8d433ac458b..fde9f4c4ea11 100644
@@ -3616,9 +3616,9 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
       * on-disk UUID directly from the super_copy.
       */
      if (fs_info->fs_devices->temp_fsid)
-             memcpy(&sb->s_uuid, fs_info->super_copy->fsid, BTRFS_FSID_SIZE);
+             super_set_uuid(sb, fs_info->super_copy->fsid, BTRFS_FSID_SIZE);
      else
-             memcpy(&sb->s_uuid, fs_info->fs_devices->fsid, BTRFS_FSID_SIZE);
+             super_set_uuid(sb, fs_info->fs_devices->fsid, BTRFS_FSID_SIZE);
 
      mutex_lock(&fs_info->chunk_mutex);
      ret = btrfs_read_sys_array(fs_info);