mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-29 23:24:11 +08:00
Btrfs: switch to div64_u64 if with a u64 divisor
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>
This commit is contained in:
parent
972d721939
commit
42c61ab676
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user