summaryrefslogtreecommitdiff
path: root/fs/btrfs/extent-tree.h
diff options
context:
space:
mode:
authorBoris Burkov <boris@bur.io>2023-06-28 20:45:29 +0300
committerDavid Sterba <dsterba@suse.com>2023-10-12 17:44:11 +0300
commit8d2990914073e167cbf0f66e724b4b617f0f4dff (patch)
treed18e4cabe906396b2a784a8659472cea8d2671c2 /fs/btrfs/extent-tree.h
parentd9a620f77e33f2b0e9a5f131f3ee3c66d3285c57 (diff)
downloadlinux-8d2990914073e167cbf0f66e724b4b617f0f4dff.tar.xz
btrfs: add helper for inline owner ref lookup
Inline ref parsing is a bit tricky and relies on a decent amount of implicit information, so I think it is beneficial to have a helper function for reading the owner ref, if only to "document" the format, along with the write path. The main subtlety of note which I was missing by open-coding this was that it is important to check whether or not inline refs are present *at all*. i.e., if we are writing out a new extent under squotas, we will always use a big enough item for the inline ref and have it. However, it is possible that some random item predating squotas will not have any inline refs. In that case, trying to read the "type" field of the first inline ref will just be reading garbage in the form of whatever is in the next item. This will be used by the extent free-ing path, which looks up data extent owners as well as a relocation path which needs to grab the owner before relocating an extent. Signed-off-by: Boris Burkov <boris@bur.io> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent-tree.h')
-rw-r--r--fs/btrfs/extent-tree.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.h b/fs/btrfs/extent-tree.h
index 397cccafc885..3c435395db06 100644
--- a/fs/btrfs/extent-tree.h
+++ b/fs/btrfs/extent-tree.h
@@ -137,6 +137,8 @@ int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
struct extent_buffer *eb, u64 flags);
int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_ref *ref);
+u64 btrfs_get_extent_owner_root(struct btrfs_fs_info *fs_info,
+ struct extent_buffer *leaf, int slot);
int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
u64 start, u64 len, int delalloc);
int btrfs_pin_reserved_extent(struct btrfs_trans_handle *trans,