diff options
author | David Sterba <dsterba@suse.cz> | 2015-01-16 17:26:13 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-03-03 17:24:00 +0100 |
commit | b8b93addde1e0192b045da8995e296fc1e40c80f (patch) | |
tree | d78234932a05c824c0feac2ada9bd0a3fce42f72 /fs/btrfs/scrub.c | |
parent | 3284da7b7b585e6e8e98f374a51d234d14c7a0a2 (diff) | |
download | linux-b8b93addde1e0192b045da8995e296fc1e40c80f.tar.bz2 |
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, for (i = 0; i < nr_data_stripes(map); i++) { *offset = last_offset + i * map->stripe_len; - stripe_nr = *offset; - do_div(stripe_nr, map->stripe_len); - do_div(stripe_nr, nr_data_stripes(map)); + stripe_nr = div_u64(*offset, map->stripe_len); + stripe_nr = div_u64(stripe_nr, nr_data_stripes(map)); /* Work out the disk rotation on this stripe-set */ rot = do_div(stripe_nr, map->num_stripes); @@ -2994,10 +2993,9 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, int extent_mirror_num; int stop_loop = 0; - nstripes = length; physical = map->stripes[num].physical; offset = 0; - do_div(nstripes, map->stripe_len); + nstripes = div_u64(length, map->stripe_len); if (map->type & BTRFS_BLOCK_GROUP_RAID0) { offset = map->stripe_len * num; increment = map->stripe_len * map->num_stripes; |