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.

Signed-off-by: Nikolay Borisov <[email protected]>
---
 fs/btrfs/inode.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index e8284cd0a122..0b9855c2df21 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6867,10 +6867,13 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode 
*inode,
                        goto not_found;
                if (start > found_key.offset)
                        goto next;
+
+               /* New extent overlaps with existing one */
                em->start = start;
                em->orig_start = 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,
@@ -6930,7 +6933,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode 
*inode,
        em->start = start;
        em->orig_start = start;
        em->len = len;
-not_found_em:
        em->block_start = EXTENT_MAP_HOLE;
 insert:
        btrfs_release_path(path);
-- 
2.17.1

Reply via email to