summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2019-08-05 16:47:06 +0200
committerDavid Sterba <dsterba@suse.com>2019-09-09 14:59:13 +0200
commit922f0518249d20d00ba11470331a2c89b6749c91 (patch)
tree07ba817584a83c1838305b7d71b61a97260e8d36 /fs/btrfs/inode.c
parentbtrfs: simplify extent type checks in run_delalloc_nocow (diff)
downloadlinux-922f0518249d20d00ba11470331a2c89b6749c91.tar.xz
linux-922f0518249d20d00ba11470331a2c89b6749c91.zip
btrfs: streamline code in run_delalloc_nocow in case of inline extents
The extent range check right after the "out_check" label is redundant, because the only way it can trigger is if we have an inline extent. In this case it makes more sense to actually move it in the branch explictly dealing with inlines extents. What's more, the nested 'if (nocow)' can never be true because for inline extents we always do COW and there is no chance 'nocow' can be true, just remove that check. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 383ad5256f70..aece5dd0e7a8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1507,17 +1507,15 @@ next_slot:
btrfs_file_extent_ram_bytes(leaf, fi);
extent_end = ALIGN(extent_end,
fs_info->sectorsize);
+ /* Skip extents outside of our requested range */
+ if (extent_end <= start) {
+ path->slots[0]++;
+ goto next_slot;
+ }
} else {
BUG();
}
out_check:
- /* Skip extents outside of our requested range */
- if (extent_end <= start) {
- path->slots[0]++;
- if (nocow)
- btrfs_dec_nocow_writers(fs_info, disk_bytenr);
- goto next_slot;
- }
/*
* If nocow is false then record the beginning of the range
* that needs to be COWed