@@ -219,6 +219,8 @@ struct btrfs_mapping_tree {
struct cache_tree cache_tree;
};
+#define BTRFS_DEV_DEDICATED_METADATA (1ULL << 0)
+
#define BTRFS_UUID_SIZE 16
struct btrfs_dev_item {
/* the internal btrfs device id */
@@ -775,6 +775,44 @@ struct btrfs_ioctl_get_subvol_rootref_args {
};
BUILD_ASSERT(sizeof(struct btrfs_ioctl_get_subvol_rootref_args) == 4096);
+#define BTRFS_DEV_PROPERTY_TYPE (1ULL << 0)
+#define BTRFS_DEV_PROPERTY_DEV_GROUP (1ULL << 1)
+#define BTRFS_DEV_PROPERTY_SEEK_SPEED (1ULL << 2)
+#define BTRFS_DEV_PROPERTY_BANDWIDTH (1ULL << 3)
+#define BTRFS_DEV_PROPERTY_READ (1ULL << 60)
+
+/*
+ * The ioctl BTRFS_IOC_DEV_PROPERTIES can read and write the device properties.
+ *
+ * The properties that the user want to write have to be set
+ * in the 'properties' field using the BTRFS_DEV_PROPERTY_xxxx constants.
+ *
+ * If the ioctl is used to read the device properties, the bit
+ * BTRFS_DEV_PROPERTY_READ has to be set in the 'properties' field.
+ * In this case the properties that the user want have to be set in the
+ * 'properties' field. The kernel doesn't return a property that was not
+ * required, however it may return a subset of the requested properties.
+ * The returned properties have the corrispondent BTRFS_DEV_PROPERTY_xxxx
+ * flag set in the 'properties' field.
+ *
+ * Up to 2020/05/11 the only properties that can be read/write is the 'type'
+ * one.
+ */
+struct btrfs_ioctl_dev_properties {
+ __u64 devid;
+ __u64 properties;
+ __u64 type;
+ __u32 dev_group;
+ __u8 seek_speed;
+ __u8 bandwidth;
+
+ /*
+ * for future expansion
+ */
+ __u8 unused1[2];
+ __u64 unused2[4];
+};
+
/* Error codes as returned by the kernel */
enum btrfs_err_code {
notused,
@@ -949,6 +987,8 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
struct btrfs_ioctl_ino_lookup_user_args)
#define BTRFS_IOC_SNAP_DESTROY_V2 _IOW(BTRFS_IOCTL_MAGIC, 63, \
struct btrfs_ioctl_vol_args_v2)
+#define BTRFS_IOC_DEV_PROPERTIES _IOW(BTRFS_IOCTL_MAGIC, 64, \
+ struct btrfs_ioctl_dev_properties)
#ifdef __cplusplus
}