From 85d288309ab5463140a2d00b3827262fb14e7db4 Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Tue, 16 Apr 2024 15:13:03 +0100 Subject: 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 Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/extent_io.c | 7 +------ 1 file changed, 1 insertion(+), 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: -- cgit v1.2.3