mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 09:59:32 +00:00
Btrfs: using for_each_set_bit_from to simplify the code
Using for_each_set_bit_from() to simplify the code. spatch with a semantic match is used to found this. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
This commit is contained in:
parent
1bcea35597
commit
ebb3dad435
1 changed files with 2 additions and 6 deletions
|
@ -1454,9 +1454,7 @@ static int search_bitmap(struct btrfs_free_space_ctl *ctl,
|
||||||
max_t(u64, *offset, bitmap_info->offset));
|
max_t(u64, *offset, bitmap_info->offset));
|
||||||
bits = bytes_to_bits(*bytes, ctl->unit);
|
bits = bytes_to_bits(*bytes, ctl->unit);
|
||||||
|
|
||||||
for (i = find_next_bit(bitmap_info->bitmap, BITS_PER_BITMAP, i);
|
for_each_set_bit_from(i, bitmap_info->bitmap, BITS_PER_BITMAP) {
|
||||||
i < BITS_PER_BITMAP;
|
|
||||||
i = find_next_bit(bitmap_info->bitmap, BITS_PER_BITMAP, i + 1)) {
|
|
||||||
next_zero = find_next_zero_bit(bitmap_info->bitmap,
|
next_zero = find_next_zero_bit(bitmap_info->bitmap,
|
||||||
BITS_PER_BITMAP, i);
|
BITS_PER_BITMAP, i);
|
||||||
if ((next_zero - i) >= bits) {
|
if ((next_zero - i) >= bits) {
|
||||||
|
@ -2307,9 +2305,7 @@ static int btrfs_bitmap_cluster(struct btrfs_block_group_cache *block_group,
|
||||||
|
|
||||||
again:
|
again:
|
||||||
found_bits = 0;
|
found_bits = 0;
|
||||||
for (i = find_next_bit(entry->bitmap, BITS_PER_BITMAP, i);
|
for_each_set_bit_from(i, entry->bitmap, BITS_PER_BITMAP) {
|
||||||
i < BITS_PER_BITMAP;
|
|
||||||
i = find_next_bit(entry->bitmap, BITS_PER_BITMAP, i + 1)) {
|
|
||||||
next_zero = find_next_zero_bit(entry->bitmap,
|
next_zero = find_next_zero_bit(entry->bitmap,
|
||||||
BITS_PER_BITMAP, i);
|
BITS_PER_BITMAP, i);
|
||||||
if (next_zero - i >= min_bits) {
|
if (next_zero - i >= min_bits) {
|
||||||
|
|
Loading…
Reference in a new issue