]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: extent_map: use rb_first_cached
authorLiu Bo <bo.liu@linux.alibaba.com>
Wed, 22 Aug 2018 19:51:52 +0000 (03:51 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 15 Oct 2018 15:23:33 +0000 (17:23 +0200)
commit0bf2819094a8de5a2d0e50bc6055a77233d6e697
tree3e4a910cd136c1b6666d3be7e33b826dbd016db6
parentd48eedc9dd315bdb807d978146768542f3900762
Btrfs: extent_map: use rb_first_cached

rb_first_cached() trades an extra pointer "leftmost" for doing the
same job as rb_first() but in O(1).

As evict_inode_truncate_pages() removes all extent mapping by always
looking for the first rb entry, it's helpful to use rb_first_cached
instead.

For more details about the optimization see patch "Btrfs: delayed-refs:
use rb_first_cached for href_root".

Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_map.c
fs/btrfs/extent_map.h
fs/btrfs/inode.c
fs/btrfs/tests/extent-map-tests.c
fs/btrfs/volumes.c