]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: do not test for free space inode during NOCOW check against file extent
authorFilipe Manana <fdmanana@suse.com>
Wed, 30 Mar 2022 14:31:07 +0000 (15:31 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 16 May 2022 15:03:11 +0000 (17:03 +0200)
commita23a0f4307189fdc8bb914b3e9a9a6b7978ceab3
treeb4b96fdabee266b11f9ead6f0a0387dc7ac2d674
parentd119c9f57d2f4a4c97f4819facb99b4f07f09295
btrfs: do not test for free space inode during NOCOW check against file extent

When checking if we can do a NOCOW write against a range covered by a file
extent item, we do a quick a check to determine if the inode's root was
snapshotted in a generation older than the generation of the file extent
item or not. This is to quickly determine if the extent is likely shared
and avoid the expensive check for cross references (this was added in
commit efc72e8cf39f01 ("btrfs: lift some btrfs_cross_ref_exist checks in
nocow path").

We restrict that check to the case where the inode is not a free space
inode (since commit 6deeb65461c1bd ("btrfs: skip file_extent generation
check for free_space_inode in run_delalloc_nocow")). That is because when
we had the inode cache feature, inode caches were backed by a free space
inode that belonged to the inode's root.

However we don't have support for the inode cache feature since kernel
5.11, so we don't need this check anymore since free space inodes are
now always related to free space caches, which are always associated to
the root tree (which can't be snapshotted, and its last_snapshot field
is always 0).

So remove that condition.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c