提交 49bac897 编写于 作者: J Johannes Thumshirn 提交者: David Sterba

btrfs: add metadata_uuid to FS_INFO ioctl

Add retrieval of the filesystem's metadata UUID to the fsinfo ioctl.
This is driven by setting the BTRFS_FS_INFO_FLAG_METADATA_UUID flag in
btrfs_ioctl_fs_info_args::flags.
Reviewed-by: NNikolay Borisov <nborisov@suse.com>
Signed-off-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 0fb408a5
...@@ -3252,6 +3252,12 @@ static long btrfs_ioctl_fs_info(struct btrfs_fs_info *fs_info, ...@@ -3252,6 +3252,12 @@ static long btrfs_ioctl_fs_info(struct btrfs_fs_info *fs_info,
fi_args->flags |= BTRFS_FS_INFO_FLAG_GENERATION; fi_args->flags |= BTRFS_FS_INFO_FLAG_GENERATION;
} }
if (flags_in & BTRFS_FS_INFO_FLAG_METADATA_UUID) {
memcpy(&fi_args->metadata_uuid, fs_devices->metadata_uuid,
sizeof(fi_args->metadata_uuid));
fi_args->flags |= BTRFS_FS_INFO_FLAG_METADATA_UUID;
}
if (copy_to_user(arg, fi_args, sizeof(*fi_args))) if (copy_to_user(arg, fi_args, sizeof(*fi_args)))
ret = -EFAULT; ret = -EFAULT;
......
...@@ -252,6 +252,8 @@ struct btrfs_ioctl_dev_info_args { ...@@ -252,6 +252,8 @@ struct btrfs_ioctl_dev_info_args {
/* Request information about filesystem generation */ /* Request information about filesystem generation */
#define BTRFS_FS_INFO_FLAG_GENERATION (1 << 1) #define BTRFS_FS_INFO_FLAG_GENERATION (1 << 1)
/* Request information about filesystem metadata UUID */
#define BTRFS_FS_INFO_FLAG_METADATA_UUID (1 << 2)
struct btrfs_ioctl_fs_info_args { struct btrfs_ioctl_fs_info_args {
__u64 max_id; /* out */ __u64 max_id; /* out */
...@@ -265,7 +267,8 @@ struct btrfs_ioctl_fs_info_args { ...@@ -265,7 +267,8 @@ struct btrfs_ioctl_fs_info_args {
__u16 csum_size; /* out */ __u16 csum_size; /* out */
__u64 flags; /* in/out */ __u64 flags; /* in/out */
__u64 generation; /* out */ __u64 generation; /* out */
__u8 reserved[960]; /* pad to 1k */ __u8 metadata_uuid[BTRFS_FSID_SIZE]; /* out */
__u8 reserved[944]; /* pad to 1k */
}; };
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册