Message ID | 9336edeaca6f158da080da16b9c2ee0270d671a9.1699036594.git.boris@bur.io (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: make OWNER_REF_KEY type value smallest among inline refs | expand |
On Fri, Nov 03, 2023 at 11:38:04AM -0700, Boris Burkov wrote: > BTRFS_EXTENT_OWNER_REF_KEY is the type of simple quotas extent owner > refs. This special inline ref goes in front of all other inline refs. > > In general, inline refs have a required sorted order s.t. type never > decreases (among other requirements). This was recently reified into a > tree-checker and fsck rule, which broke simple quotas. To be fair, > though, in a sense, the new owner ref item had also violated that not > yet fully enforced requirement. > > This fix brings the owner ref item into compliance with the requirement > that inline ref type never decrease. > > btrfs/301 exercises this behavior and should pass again with this fix. > > Fixes: 1d014d89f9ef (btrfs: tree-checker: add type and sequence check for inline backrefs) > Signed-off-by: Boris Burkov <boris@bur.io> Added to misc-next and I'll add it to the next week pull request, once it's merged to Linus' tree I'll do a progs 6.6.2 witht the user space part. Until then the tests may if the kernel and progs are not in sync.
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h index c25fc9614594..d24e8e121507 100644 --- a/include/uapi/linux/btrfs_tree.h +++ b/include/uapi/linux/btrfs_tree.h @@ -219,6 +219,22 @@ */ #define BTRFS_METADATA_ITEM_KEY 169 +/* + * 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. + * + * Stored as an inline ref rather to avoid wasting space on a separate item on + * top of the existing extent item. However, unlike the other inline refs, + * there is one one owner ref per extent rather than one per extent. + * + * Because of this, it goes at the front of the list of inline refs, and thus + * must have a lower type value than any other inline ref type (to satisfy the + * disk format rule that inline refs have non-decreasing type). + */ +#define BTRFS_EXTENT_OWNER_REF_KEY 172 + #define BTRFS_TREE_BLOCK_REF_KEY 176 #define BTRFS_EXTENT_DATA_REF_KEY 178 @@ -233,14 +249,6 @@ #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
BTRFS_EXTENT_OWNER_REF_KEY is the type of simple quotas extent owner refs. This special inline ref goes in front of all other inline refs. In general, inline refs have a required sorted order s.t. type never decreases (among other requirements). This was recently reified into a tree-checker and fsck rule, which broke simple quotas. To be fair, though, in a sense, the new owner ref item had also violated that not yet fully enforced requirement. This fix brings the owner ref item into compliance with the requirement that inline ref type never decrease. btrfs/301 exercises this behavior and should pass again with this fix. Fixes: 1d014d89f9ef (btrfs: tree-checker: add type and sequence check for inline backrefs) Signed-off-by: Boris Burkov <boris@bur.io> --- include/uapi/linux/btrfs_tree.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)