aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2012-09-13 22:29:02 -0400
committerChris Mason <chris.mason@fusionio.com>2012-10-04 09:39:55 -0400
commitebb3dad4353b94c12a5cffab4397727c19f088e5 (patch)
treec3477a839310b70548d63277e630e057b1e4a704
parent1bcea35597693b3ac1ec1b311cfd42d52972a710 (diff)
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>
-rw-r--r--fs/btrfs/free-space-cache.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 6b10acfc2f5c..b107e68797f4 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1454,9 +1454,7 @@ static int search_bitmap(struct btrfs_free_space_ctl *ctl,
1454 max_t(u64, *offset, bitmap_info->offset)); 1454 max_t(u64, *offset, bitmap_info->offset));
1455 bits = bytes_to_bits(*bytes, ctl->unit); 1455 bits = bytes_to_bits(*bytes, ctl->unit);
1456 1456
1457 for (i = find_next_bit(bitmap_info->bitmap, BITS_PER_BITMAP, i); 1457 for_each_set_bit_from(i, bitmap_info->bitmap, BITS_PER_BITMAP) {
1458 i < BITS_PER_BITMAP;
1459 i = find_next_bit(bitmap_info->bitmap, BITS_PER_BITMAP, i + 1)) {
1460 next_zero = find_next_zero_bit(bitmap_info->bitmap, 1458 next_zero = find_next_zero_bit(bitmap_info->bitmap,
1461 BITS_PER_BITMAP, i); 1459 BITS_PER_BITMAP, i);
1462 if ((next_zero - i) >= bits) { 1460 if ((next_zero - i) >= bits) {
@@ -2307,9 +2305,7 @@ static int btrfs_bitmap_cluster(struct btrfs_block_group_cache *block_group,
2307 2305
2308again: 2306again:
2309 found_bits = 0; 2307 found_bits = 0;
2310 for (i = find_next_bit(entry->bitmap, BITS_PER_BITMAP, i); 2308 for_each_set_bit_from(i, entry->bitmap, BITS_PER_BITMAP) {
2311 i < BITS_PER_BITMAP;
2312 i = find_next_bit(entry->bitmap, BITS_PER_BITMAP, i + 1)) {
2313 next_zero = find_next_zero_bit(entry->bitmap, 2309 next_zero = find_next_zero_bit(entry->bitmap,
2314 BITS_PER_BITMAP, i); 2310 BITS_PER_BITMAP, i);
2315 if (next_zero - i >= min_bits) { 2311 if (next_zero - i >= min_bits) {