diff options
author | Filipe Manana <fdmanana@suse.com> | 2020-11-13 12:24:17 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-12-08 15:54:12 +0100 |
commit | f30bed83426c5cb9fce6cabb3f7cc5a9d5428fcc (patch) | |
tree | 70b0411857cc9903940e01908c2cc6496abed405 /fs/btrfs | |
parent | btrfs: stop incrementing log batch when joining log transaction (diff) | |
download | linux-f30bed83426c5cb9fce6cabb3f7cc5a9d5428fcc.tar.xz linux-f30bed83426c5cb9fce6cabb3f7cc5a9d5428fcc.zip |
btrfs: remove unnecessary attempt to drop extent maps after adding inline extent
At inode.c:cow_file_range_inline(), after we insert the inline extent
in the fs/subvolume btree, we call btrfs_drop_extent_cache() to drop
all extent maps in the file range, however that is not necessary because
we have already done it in the call to btrfs_drop_extents(), which calls
btrfs_drop_extent_cache() for us, and since at this point we have the file
range locked in the inode's iotree (we are in the writeback path), we know
no other task can come in and read stale file extent items or find none
and therefore create either stale extent maps or an extent map that
represents a hole.
So just remove that unnecessary call to btrfs_drop_extent_cache(), as it's
doing nothing and only wasting time. This call has been around since 2008,
introduced in commit c8b978188c9a ("Btrfs: Add zlib compression support"),
but even back then it seems it was not necessary, since we had the range
locked in the inode's iotree and the call to btrfs_drop_extents() already
used to always call btrfs_drop_extent_cache().
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5b9815b2c3ba..abc0fd162f6c 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -392,7 +392,6 @@ static noinline int cow_file_range_inline(struct btrfs_inode *inode, u64 start, } set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags); - btrfs_drop_extent_cache(inode, start, aligned_end - 1, 0); out: /* * Don't forget to free the reserved space, as for inlined extent |