@@ -419,9 +419,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
BUG_ON(ret);
}
if (new_flags != 0) {
- ret = btrfs_set_disk_extent_flags(trans, buf->start,
- btrfs_header_level(buf),
- new_flags);
+ ret = btrfs_set_disk_extent_flags(trans, buf, new_flags);
BUG_ON(ret);
}
} else {
@@ -859,8 +859,8 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 bytenr,
u64 offset, int metadata, u64 *refs, u64 *flags);
-int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans, u64 bytenr,
- int level, u64 flags);
+int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
+ struct extent_buffer *eb, u64 flags);
int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct extent_buffer *buf, int record_parent);
int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
@@ -1375,26 +1375,29 @@ out:
return ret;
}
-int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans, u64 bytenr,
- int level, u64 flags)
+int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
+ struct extent_buffer *eb, u64 flags)
{
struct btrfs_fs_info *fs_info = trans->fs_info;
- struct btrfs_root *extent_root = btrfs_extent_root(fs_info, bytenr);
+ struct btrfs_root *extent_root;
struct btrfs_path *path;
int ret;
struct btrfs_key key;
struct extent_buffer *l;
struct btrfs_extent_item *item;
u32 item_size;
+ u64 bytenr = eb->start;
int skinny_metadata = btrfs_fs_incompat(fs_info, SKINNY_METADATA);
path = btrfs_alloc_path();
if (!path)
return -ENOMEM;
+ extent_root = btrfs_extent_root(fs_info, bytenr);
+
key.objectid = bytenr;
if (skinny_metadata) {
- key.offset = level;
+ key.offset = btrfs_header_level(eb);
key.type = BTRFS_METADATA_ITEM_KEY;
} else {
key.offset = fs_info->nodesize;
In the kernel we just pass in the extent_buffer and get the fields we need from that to update the extent ref flags. Update this helper to match the kernel to make syncing ctree.c easier. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- kernel-shared/ctree.c | 4 +--- kernel-shared/ctree.h | 4 ++-- kernel-shared/extent-tree.c | 11 +++++++---- 3 files changed, 10 insertions(+), 9 deletions(-)