Skip to content

Commit 02a033d

Browse files
lorddoskiaskdave
authored andcommitted
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: Johannes Thumshirn <[email protected]> Signed-off-by: Nikolay Borisov <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent b8eeab7 commit 02a033d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/btrfs/inode.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6858,10 +6858,13 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
68586858
goto not_found;
68596859
if (start > found_key.offset)
68606860
goto next;
6861+
6862+
/* New extent overlaps with existing one */
68616863
em->start = start;
68626864
em->orig_start = start;
68636865
em->len = found_key.offset - start;
6864-
goto not_found_em;
6866+
em->block_start = EXTENT_MAP_HOLE;
6867+
goto insert;
68656868
}
68666869

68676870
btrfs_extent_item_to_extent_map(inode, path, item,
@@ -6921,7 +6924,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
69216924
em->start = start;
69226925
em->orig_start = start;
69236926
em->len = len;
6924-
not_found_em:
69256927
em->block_start = EXTENT_MAP_HOLE;
69266928
insert:
69276929
btrfs_release_path(path);

0 commit comments

Comments
 (0)