summaryrefslogtreecommitdiff
path: root/fs/bcachefs/bcachefs_ioctl.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-11-24 03:26:27 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-01 19:47:38 +0300
commite6674decb2195999ae9fe074bf048ba91e336144 (patch)
treed348698f40080701cfa63b5c98a8d6a4e0095709 /fs/bcachefs/bcachefs_ioctl.h
parent3b05b8e08292eafec277e8780d79b2a2d8584af2 (diff)
downloadlinux-e6674decb2195999ae9fe074bf048ba91e336144.tar.xz
bcachefs: BCH_IOCTL_DEV_USAGE_V2
BCH_IOCTL_DEV_USAGE mistakenly put the per-data-type array in struct bch_ioctl_dev_usage; since ioctl numbers encode the size of the arg, that means adding new data types breaks the ioctl. This adds a new version that includes the number of data types as a parameter: the old version is fixed at 10 so as to not break when adding new types. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bcachefs_ioctl.h')
-rw-r--r--fs/bcachefs/bcachefs_ioctl.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/bcachefs/bcachefs_ioctl.h b/fs/bcachefs/bcachefs_ioctl.h
index 18eb325401cf..44ba7a87aea7 100644
--- a/fs/bcachefs/bcachefs_ioctl.h
+++ b/fs/bcachefs/bcachefs_ioctl.h
@@ -81,6 +81,8 @@ struct bch_ioctl_incremental {
#define BCH_IOCTL_SUBVOLUME_CREATE _IOW(0xbc, 16, struct bch_ioctl_subvolume)
#define BCH_IOCTL_SUBVOLUME_DESTROY _IOW(0xbc, 17, struct bch_ioctl_subvolume)
+#define BCH_IOCTL_DEV_USAGE_V2 _IOWR(0xbc, 18, struct bch_ioctl_dev_usage_v2)
+
/* ioctl below act on a particular file, not the filesystem as a whole: */
#define BCHFS_IOC_REINHERIT_ATTRS _IOR(0xbc, 64, const char __user *)
@@ -298,7 +300,20 @@ struct bch_ioctl_dev_usage {
__u64 buckets;
__u64 sectors;
__u64 fragmented;
- } d[BCH_DATA_NR];
+ } d[10];
+};
+
+struct bch_ioctl_dev_usage_v2 {
+ __u64 dev;
+ __u32 flags;
+ __u8 state;
+ __u8 nr_data_types;
+ __u8 pad[6];
+
+ __u32 bucket_size;
+ __u64 nr_buckets;
+
+ struct bch_ioctl_dev_usage_type d[0];
};
/*