diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2013-07-10 18:41:17 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2013-07-10 18:41:17 -0400 |
commit | 553d8fe029a561d5921fba495206e64eefea42cb (patch) | |
tree | c7d47557d836331155540e3625a90cd88ead5981 /drivers/md/dm-verity.c | |
parent | 75e3a0f55bf097dab76c662358bcb7c88928f49d (diff) |
dm verity: use __ffs and __fls
This patch changes ffs() to __ffs() and fls() to __fls() which don't add
one to the result.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-verity.c')
-rw-r--r-- | drivers/md/dm-verity.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c index 9804da16a476..4b7941db3aff 100644 --- a/drivers/md/dm-verity.c +++ b/drivers/md/dm-verity.c | |||
@@ -451,7 +451,7 @@ static void verity_prefetch_io(struct work_struct *work) | |||
451 | goto no_prefetch_cluster; | 451 | goto no_prefetch_cluster; |
452 | 452 | ||
453 | if (unlikely(cluster & (cluster - 1))) | 453 | if (unlikely(cluster & (cluster - 1))) |
454 | cluster = 1 << (fls(cluster) - 1); | 454 | cluster = 1 << __fls(cluster); |
455 | 455 | ||
456 | hash_block_start &= ~(sector_t)(cluster - 1); | 456 | hash_block_start &= ~(sector_t)(cluster - 1); |
457 | hash_block_end |= cluster - 1; | 457 | hash_block_end |= cluster - 1; |
@@ -723,7 +723,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
723 | r = -EINVAL; | 723 | r = -EINVAL; |
724 | goto bad; | 724 | goto bad; |
725 | } | 725 | } |
726 | v->data_dev_block_bits = ffs(num) - 1; | 726 | v->data_dev_block_bits = __ffs(num); |
727 | 727 | ||
728 | if (sscanf(argv[4], "%u%c", &num, &dummy) != 1 || | 728 | if (sscanf(argv[4], "%u%c", &num, &dummy) != 1 || |
729 | !num || (num & (num - 1)) || | 729 | !num || (num & (num - 1)) || |
@@ -733,7 +733,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
733 | r = -EINVAL; | 733 | r = -EINVAL; |
734 | goto bad; | 734 | goto bad; |
735 | } | 735 | } |
736 | v->hash_dev_block_bits = ffs(num) - 1; | 736 | v->hash_dev_block_bits = __ffs(num); |
737 | 737 | ||
738 | if (sscanf(argv[5], "%llu%c", &num_ll, &dummy) != 1 || | 738 | if (sscanf(argv[5], "%llu%c", &num_ll, &dummy) != 1 || |
739 | (sector_t)(num_ll << (v->data_dev_block_bits - SECTOR_SHIFT)) | 739 | (sector_t)(num_ll << (v->data_dev_block_bits - SECTOR_SHIFT)) |
@@ -812,7 +812,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
812 | } | 812 | } |
813 | 813 | ||
814 | v->hash_per_block_bits = | 814 | v->hash_per_block_bits = |
815 | fls((1 << v->hash_dev_block_bits) / v->digest_size) - 1; | 815 | __fls((1 << v->hash_dev_block_bits) / v->digest_size); |
816 | 816 | ||
817 | v->levels = 0; | 817 | v->levels = 0; |
818 | if (v->data_blocks) | 818 | if (v->data_blocks) |