diff options
author | David Sterba <dsterba@suse.cz> | 2015-01-16 11:26:13 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-03-03 11:24:00 -0500 |
commit | b8b93addde1e0192b045da8995e296fc1e40c80f (patch) | |
tree | d78234932a05c824c0feac2ada9bd0a3fce42f72 /fs/btrfs/scrub.c | |
parent | 3284da7b7b585e6e8e98f374a51d234d14c7a0a2 (diff) |
btrfs: cleanup 64bit/32bit divs, provably bounded values
The divisor is derived from nodesize or PAGE_SIZE, fits into 32bit type.
Get rid of a few more do_div instances.
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/scrub.c')
-rw-r--r-- | fs/btrfs/scrub.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 5a7d63cd9c25..293262163daf 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -2623,9 +2623,8 @@ static int get_raid56_logic_offset(u64 physical, int num, | |||
2623 | for (i = 0; i < nr_data_stripes(map); i++) { | 2623 | for (i = 0; i < nr_data_stripes(map); i++) { |
2624 | *offset = last_offset + i * map->stripe_len; | 2624 | *offset = last_offset + i * map->stripe_len; |
2625 | 2625 | ||
2626 | stripe_nr = *offset; | 2626 | stripe_nr = div_u64(*offset, map->stripe_len); |
2627 | do_div(stripe_nr, map->stripe_len); | 2627 | stripe_nr = div_u64(stripe_nr, nr_data_stripes(map)); |
2628 | do_div(stripe_nr, nr_data_stripes(map)); | ||
2629 | 2628 | ||
2630 | /* Work out the disk rotation on this stripe-set */ | 2629 | /* Work out the disk rotation on this stripe-set */ |
2631 | rot = do_div(stripe_nr, map->num_stripes); | 2630 | rot = do_div(stripe_nr, map->num_stripes); |
@@ -2994,10 +2993,9 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, | |||
2994 | int extent_mirror_num; | 2993 | int extent_mirror_num; |
2995 | int stop_loop = 0; | 2994 | int stop_loop = 0; |
2996 | 2995 | ||
2997 | nstripes = length; | ||
2998 | physical = map->stripes[num].physical; | 2996 | physical = map->stripes[num].physical; |
2999 | offset = 0; | 2997 | offset = 0; |
3000 | do_div(nstripes, map->stripe_len); | 2998 | nstripes = div_u64(length, map->stripe_len); |
3001 | if (map->type & BTRFS_BLOCK_GROUP_RAID0) { | 2999 | if (map->type & BTRFS_BLOCK_GROUP_RAID0) { |
3002 | offset = map->stripe_len * num; | 3000 | offset = map->stripe_len * num; |
3003 | increment = map->stripe_len * map->num_stripes; | 3001 | increment = map->stripe_len * map->num_stripes; |