diff options
author | Nikolay Borisov <nborisov@suse.com> | 2018-09-13 15:05:07 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-10-31 18:24:13 +0100 |
commit | bf60039cbed6228b94341e2faba326608d4b2093 (patch) | |
tree | c11d77306ba42f846e7b67d8d066448f1899fcca /check | |
parent | a9cddf632fc16ba935d540cbace10c70acb1cd3b (diff) |
btrfs-progs: check: lowmem: Refactor extent type checks in check_file_extent
Make the checks in check_file_extent a bit more explicit. First we check
for unknown type and fail accordingly. Then we check for inline extent
and handle it in the newly introduced check_file_extent_inline. Finally
if none of the above checks triggered then we must have a regular or
prealloc extents.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'check')
-rw-r--r-- | check/mode-lowmem.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 2c1ec85f..427b2fe4 100644 --- a/check/mode-lowmem.c +++ b/check/mode-lowmem.c @@ -1908,21 +1908,22 @@ static int check_file_extent(struct btrfs_root *root, struct btrfs_path *path, btrfs_item_key_to_cpu(node, &fkey, slot); fi = btrfs_item_ptr(node, slot, struct btrfs_file_extent_item); - - /* Check inline extent */ extent_type = btrfs_file_extent_type(node, fi); - if (extent_type == BTRFS_FILE_EXTENT_INLINE) - return check_file_extent_inline(root, path, size, end); /* Check extent type */ if (extent_type != BTRFS_FILE_EXTENT_REG && - extent_type != BTRFS_FILE_EXTENT_PREALLOC) { + extent_type != BTRFS_FILE_EXTENT_PREALLOC && + extent_type != BTRFS_FILE_EXTENT_INLINE) { err |= FILE_EXTENT_ERROR; error("root %llu EXTENT_DATA[%llu %llu] type bad", root->objectid, fkey.objectid, fkey.offset); return err; } + /* Check inline extent */ + if (extent_type == BTRFS_FILE_EXTENT_INLINE) + return check_file_extent_inline(root, path, size, end); + /* Check REG_EXTENT/PREALLOC_EXTENT */ disk_bytenr = btrfs_file_extent_disk_bytenr(node, fi); disk_num_bytes = btrfs_file_extent_disk_num_bytes(node, fi); |