@@ -2610,6 +2610,9 @@ static long btrfs_ioctl_dev_info(struct btrfs_root *root, void __user *arg)
di_args->devid = dev->devid;
di_args->bytes_used = dev->bytes_used;
di_args->total_bytes = dev->total_bytes;
+ di_args->flags = BTRFS_IOCTL_DEV_INFO_FLAG_SET;
+ if (dev->missing)
+ di_args->flags |= BTRFS_IOCTL_DEV_INFO_MISSING;
memcpy(di_args->uuid, dev->uuid, sizeof(di_args->uuid));
if (dev->name) {
struct rcu_string *name;
@@ -168,12 +168,15 @@ struct btrfs_ioctl_dev_replace_args {
__u64 spare[64];
};
+#define BTRFS_IOCTL_DEV_INFO_MISSING (1ULL<<0)
+#define BTRFS_IOCTL_DEV_INFO_FLAG_SET (1ULL<<63)
struct btrfs_ioctl_dev_info_args {
__u64 devid; /* in/out */
__u8 uuid[BTRFS_UUID_SIZE]; /* in/out */
__u64 bytes_used; /* out */
__u64 total_bytes; /* out */
- __u64 unused[379]; /* pad to 4k */
+ __u64 flags; /* out */
+ __u64 unused[378]; /* pad to 4k */
__u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */
};
Add flags member for btrfs_ioctl_dev_info_args to preset missing btrfs devices. The new member is added in the original padding area so the ioctl API is not affected but user headers needs to be updated. Cc: Anand Jain <Anand.Jain@oracle.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> --- fs/btrfs/ioctl.c | 3 +++ include/uapi/linux/btrfs.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-)