Btrfs: switch to div64_u64 if with a u64 divisor
authorLiu Bo <bo.li.liu@oracle.com>
Mon, 3 Apr 2017 20:45:24 +0000 (13:45 -0700)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Apr 2017 12:07:26 +0000 (14:07 +0200)
This is fixing code pieces where we use div_u64 when passing a u64 divisor.

Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/dev-replace.c
fs/btrfs/scrub.c
fs/btrfs/volumes.c

index 32b2ffbb571764023d54ff4292d18a44f027fbbf..5fe1ca8abc70577fe28ee6fd69899d11b618d479 100644 (file)
@@ -667,7 +667,7 @@ void btrfs_dev_replace_status(struct btrfs_fs_info *fs_info,
        case BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED:
        case BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED:
                srcdev = dev_replace->srcdev;
-               args->status.progress_1000 = div_u64(dev_replace->cursor_left,
+               args->status.progress_1000 = div64_u64(dev_replace->cursor_left,
                        div_u64(btrfs_device_get_total_bytes(srcdev), 1000));
                break;
        }
index 58c5864bf7090dfba9cf9139966b038e7534dc1e..4786eff5301167dd842a73929fba5e584ac4a480 100644 (file)
@@ -2705,7 +2705,7 @@ 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 = div_u64(*offset, map->stripe_len);
+               stripe_nr = div64_u64(*offset, map->stripe_len);
                stripe_nr = div_u64(stripe_nr, nr_data_stripes(map));
 
                /* Work out the disk rotation on this stripe-set */
@@ -3108,7 +3108,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
 
        physical = map->stripes[num].physical;
        offset = 0;
-       nstripes = div_u64(length, map->stripe_len);
+       nstripes = div64_u64(length, map->stripe_len);
        if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
                offset = map->stripe_len * num;
                increment = map->stripe_len * map->num_stripes;
index 3b3be8eba776623c4f6072119352a73192e0564a..2a4eada257436dd65d59fa2a97ea96bd0b5ba60b 100644 (file)
@@ -4816,7 +4816,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
        stripe_size = div_u64(stripe_size, dev_stripes);
 
        /* align to BTRFS_STRIPE_LEN */
-       stripe_size = div_u64(stripe_size, raid_stripe_len);
+       stripe_size = div64_u64(stripe_size, raid_stripe_len);
        stripe_size *= raid_stripe_len;
 
        map = kmalloc(map_lookup_size(num_stripes), GFP_NOFS);
@@ -5361,7 +5361,7 @@ static int __btrfs_map_block_for_discard(struct btrfs_fs_info *fs_info,
        stripe_offset = offset - stripe_nr * stripe_len;
 
        stripe_nr_end = round_up(offset + length, map->stripe_len);
-       stripe_nr_end = div_u64(stripe_nr_end, map->stripe_len);
+       stripe_nr_end = div64_u64(stripe_nr_end, map->stripe_len);
        stripe_cnt = stripe_nr_end - stripe_nr;
        stripe_end_offset = stripe_nr_end * map->stripe_len -
                            (offset + length);
@@ -5801,7 +5801,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info,
                    (op == BTRFS_MAP_WRITE || op == BTRFS_MAP_GET_READ_MIRRORS ||
                     mirror_num > 1)) {
                        /* push stripe_nr back to the start of the full stripe */
-                       stripe_nr = div_u64(raid56_full_stripe_start,
+                       stripe_nr = div64_u64(raid56_full_stripe_start,
                                        stripe_len * nr_data_stripes(map));
 
                        /* RAID[56] write or recovery. Return all stripes */
@@ -5998,7 +5998,7 @@ int btrfs_rmap_block(struct btrfs_fs_info *fs_info,
                        continue;
 
                stripe_nr = physical - map->stripes[i].physical;
-               stripe_nr = div_u64(stripe_nr, map->stripe_len);
+               stripe_nr = div64_u64(stripe_nr, map->stripe_len);
 
                if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
                        stripe_nr = stripe_nr * map->num_stripes + i;