]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: optimize free space tree bitmap conversion
authorHoward McLauchlan <hmclauchlan@fb.com>
Thu, 19 Apr 2018 01:02:36 +0000 (18:02 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 16:07:18 +0000 (18:07 +0200)
commitae61b58813716b7b50de00954c4bdc0753748276
tree8ddc9f1f6b1d487fb7715aa621d5d6d415250588
parent4ab645e7013d241e19afea4614648100afa28ae4
btrfs: optimize free space tree bitmap conversion

Presently, convert_free_space_to_extents() does a linear scan of the
bitmap. We can speed this up with find_next_{bit,zero_bit}_le().

This patch replaces the linear scan with find_next_{bit,zero_bit}_le().
Testing shows a 20-33% decrease in execution time for
convert_free_space_to_extents().

Since we change bitmap to be unsigned long, we have to do some casting
for the bitmap cursor. In le_bitmap_set() it makes sense to use u8, as
we are doing bit operations. Everywhere else, we're just using it for
pointer arithmetic and not directly accessing it, so char seems more
appropriate.

Suggested-by: Omar Sandoval <osandov@osandov.com>
Signed-off-by: Howard McLauchlan <hmclauchlan@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/free-space-tree.c