Commit 02a033df authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Remove not_found_em label from btrfs_get_extent

In order to avoid duplicating init code for em there is an additional
label, not_found_em, which is used to only set ->block_start. The only
case when it will be used is if the extent we are adding overlaps with
an existing extent. Make that case more obvious by:

 1. Adding a comment hinting at what's going on
 2. Assigning EXTENT_MAP_HOLE and directly going to insert.

 No functional changes.
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b8eeab7f
...@@ -6858,10 +6858,13 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -6858,10 +6858,13 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
goto not_found; goto not_found;
if (start > found_key.offset) if (start > found_key.offset)
goto next; goto next;
/* New extent overlaps with existing one */
em->start = start; em->start = start;
em->orig_start = start; em->orig_start = start;
em->len = found_key.offset - start; em->len = found_key.offset - start;
goto not_found_em; em->block_start = EXTENT_MAP_HOLE;
goto insert;
} }
btrfs_extent_item_to_extent_map(inode, path, item, btrfs_extent_item_to_extent_map(inode, path, item,
...@@ -6921,7 +6924,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -6921,7 +6924,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
em->start = start; em->start = start;
em->orig_start = start; em->orig_start = start;
em->len = len; em->len = len;
not_found_em:
em->block_start = EXTENT_MAP_HOLE; em->block_start = EXTENT_MAP_HOLE;
insert: insert:
btrfs_release_path(path); btrfs_release_path(path);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment