summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2024-04-16 15:13:03 +0100
committerDavid Sterba <dsterba@suse.com>2024-05-07 21:31:07 +0200
commit85d288309ab5463140a2d00b3827262fb14e7db4 (patch)
tree5a9b6f670cf99e145533965fdf2e56945f3b9a99 /fs/btrfs/extent_io.c
parent078b981aaa565040348cd3ca75b0ec9e138464a9 (diff)
downloadlinux-85d288309ab5463140a2d00b3827262fb14e7db4.tar.gz
linux-85d288309ab5463140a2d00b3827262fb14e7db4.tar.bz2
linux-85d288309ab5463140a2d00b3827262fb14e7db4.zip
btrfs: use btrfs_get_fs_generation() at try_release_extent_mapping()
Nowadays we have the btrfs_get_fs_generation() to get the current generation of the filesystem, so there's no need anymore to lock the transaction spinlock to read it. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.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/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 6438c3e74756..f689c53553e3 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2406,8 +2406,7 @@ int try_release_extent_mapping(struct page *page, gfp_t mask)
page->mapping->host->i_size > SZ_16M) {
u64 len;
while (start <= end) {
- struct btrfs_fs_info *fs_info;
- u64 cur_gen;
+ const u64 cur_gen = btrfs_get_fs_generation(inode->root->fs_info);
len = end - start + 1;
write_lock(&extent_tree->lock);
@@ -2442,10 +2441,6 @@ int try_release_extent_mapping(struct page *page, gfp_t mask)
* Otherwise don't remove it, we could be racing with an
* ongoing fast fsync that could miss the new extent.
*/
- fs_info = inode->root->fs_info;
- spin_lock(&fs_info->trans_lock);
- cur_gen = fs_info->generation;
- spin_unlock(&fs_info->trans_lock);
if (em->generation >= cur_gen)
goto next;
remove_em: