summaryrefslogtreecommitdiff
path: root/fs/btrfs/scrub.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2021-02-05 15:55:36 +0300
committerDavid Sterba <dsterba@suse.com>2021-02-22 19:15:55 +0300
commit20903032cd9f0260b99aeab92e6540f0350e4a23 (patch)
treef397f1d78b7af75ea2f44d536faa1591e3c5a19e /fs/btrfs/scrub.c
parent3c17916510428dbccdf657de050c34e208347089 (diff)
downloadlinux-20903032cd9f0260b99aeab92e6540f0350e4a23.tar.xz
btrfs: avoid checking for RO block group twice during nocow writeback
During the nocow writeback path, we currently iterate the rbtree of block groups twice: once for checking if the target block group is RO with the call to btrfs_extent_readonly()), and once again for getting a nocow reference on the block group with a call to btrfs_inc_nocow_writers(). Since btrfs_inc_nocow_writers() already returns false when the target block group is RO, remove the call to btrfs_extent_readonly(). Not only we avoid searching the blocks group rbtree twice, it also helps reduce contention on the lock that protects it (specially since it is a spin lock and not a read-write lock). That may make a noticeable difference on very large filesystems, with thousands of allocated block groups. Reviewed-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/scrub.c')
0 files changed, 0 insertions, 0 deletions