aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/uapi/linux/btrfs_tree.h
diff options
context:
space:
mode:
authorBoris Burkov <boris@bur.io>2023-01-30 14:45:55 -0800
committerDavid Sterba <dsterba@suse.com>2023-10-12 16:44:11 +0200
commitd9a620f77e33f2b0e9a5f131f3ee3c66d3285c57 (patch)
tree58c86124cd45a5777de063a8efa5b5cd08454302 /include/uapi/linux/btrfs_tree.h
parentbtrfs: track original extent owner in head_ref (diff)
downloadwireguard-linux-d9a620f77e33f2b0e9a5f131f3ee3c66d3285c57.tar.xz
wireguard-linux-d9a620f77e33f2b0e9a5f131f3ee3c66d3285c57.zip
btrfs: new inline ref storing owning subvol of data extents
In order to implement simple quota groups, we need to be able to associate a data extent with the subvolume that created it. Once you account for reflink, this information cannot be recovered without explicitly storing it. Options for storing it are: - a new key/item - a new extent inline ref item The former is backwards compatible, but wastes space, the latter is incompat, but is efficient in space and reuses the existing inline ref machinery, while only abusing it a tiny amount -- specifically, the new item is not a ref, per-se. Signed-off-by: Boris Burkov <boris@bur.io> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'include/uapi/linux/btrfs_tree.h')
-rw-r--r--include/uapi/linux/btrfs_tree.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index a1d5347f6adb..8b4def6aee52 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -234,6 +234,14 @@
#define BTRFS_SHARED_DATA_REF_KEY 184
/*
+ * Special inline ref key which stores the id of the subvolume which originally
+ * created the extent. This subvolume owns the extent permanently from the
+ * perspective of simple quotas. Needed to know which subvolume to free quota
+ * usage from when the extent is deleted.
+ */
+#define BTRFS_EXTENT_OWNER_REF_KEY 188
+
+/*
* block groups give us hints into the extent allocation trees. Which
* blocks are free etc etc
*/
@@ -816,6 +824,10 @@ struct btrfs_shared_data_ref {
__le32 count;
} __attribute__ ((__packed__));
+struct btrfs_extent_owner_ref {
+ __le64 root_id;
+} __attribute__ ((__packed__));
+
struct btrfs_extent_inline_ref {
__u8 type;
__le64 offset;