diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2017-08-19 00:15:19 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-08-21 18:47:43 +0300 |
commit | 3de28d579edbd35294bf44aee8402c804331bc37 (patch) | |
tree | 774b86c99f704645b1c650d0fad89c635275c345 /fs/btrfs/backref.c | |
parent | 167ce953ca55bdee20fe56c3c0fa51002435f745 (diff) | |
download | linux-3de28d579edbd35294bf44aee8402c804331bc37.tar.xz |
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.c | 11 |
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); |