]> 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)
commit7cd9c105b96353dee26c8c60e0187e7afd8adea3
tree8ddc9f1f6b1d487fb7715aa621d5d6d415250588
parente767af5ce7497d9ce40f8d6fa07775b527d42aee
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