aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/backref.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2017-08-18 15:15:19 -0600
committerDavid Sterba <dsterba@suse.com>2017-08-21 17:47:43 +0200
commit3de28d579edbd35294bf44aee8402c804331bc37 (patch)
tree774b86c99f704645b1c650d0fad89c635275c345 /fs/btrfs/backref.c
parentBtrfs: add a helper to retrive extent inline ref type (diff)
downloadlinux-dev-3de28d579edbd35294bf44aee8402c804331bc37.tar.xz
linux-dev-3de28d579edbd35294bf44aee8402c804331bc37.zip
Btrfs: convert to use btrfs_get_extent_inline_ref_type
Since we have a helper which can do sanity check, this converts all btrfs_extent_inline_ref_type to it. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/backref.c')
-rw-r--r--fs/btrfs/backref.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 6bae986bfcfb..b517ef1477ea 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -929,7 +929,11 @@ static int add_inline_refs(const struct btrfs_fs_info *fs_info,
int type;
iref = (struct btrfs_extent_inline_ref *)ptr;
- type = btrfs_extent_inline_ref_type(leaf, iref);
+ type = btrfs_get_extent_inline_ref_type(leaf, iref,
+ BTRFS_REF_TYPE_ANY);
+ if (type == BTRFS_REF_TYPE_INVALID)
+ return -EINVAL;
+
offset = btrfs_extent_inline_ref_offset(leaf, iref);
switch (type) {
@@ -1776,7 +1780,10 @@ static int get_extent_inline_ref(unsigned long *ptr,
end = (unsigned long)ei + item_size;
*out_eiref = (struct btrfs_extent_inline_ref *)(*ptr);
- *out_type = btrfs_extent_inline_ref_type(eb, *out_eiref);
+ *out_type = btrfs_get_extent_inline_ref_type(eb, *out_eiref,
+ BTRFS_REF_TYPE_ANY);
+ if (*out_type == BTRFS_REF_TYPE_INVALID)
+ return -EINVAL;
*ptr += btrfs_extent_inline_ref_size(*out_type);
WARN_ON(*ptr > end);