aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 5b77982ab6b1..d712c46c0a6b 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3021,7 +3021,7 @@ static int chunk_drange_filter(struct extent_buffer *leaf,
3021 3021
3022 stripe_offset = btrfs_stripe_offset(leaf, stripe); 3022 stripe_offset = btrfs_stripe_offset(leaf, stripe);
3023 stripe_length = btrfs_chunk_length(leaf, chunk); 3023 stripe_length = btrfs_chunk_length(leaf, chunk);
3024 do_div(stripe_length, factor); 3024 stripe_length = div_u64(stripe_length, factor);
3025 3025
3026 if (stripe_offset < bargs->pend && 3026 if (stripe_offset < bargs->pend &&
3027 stripe_offset + stripe_length > bargs->pstart) 3027 stripe_offset + stripe_length > bargs->pstart)
@@ -4399,8 +4399,8 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
4399 */ 4399 */
4400 if (stripe_size * data_stripes > max_chunk_size) { 4400 if (stripe_size * data_stripes > max_chunk_size) {
4401 u64 mask = (1ULL << 24) - 1; 4401 u64 mask = (1ULL << 24) - 1;
4402 stripe_size = max_chunk_size; 4402
4403 do_div(stripe_size, data_stripes); 4403 stripe_size = div_u64(max_chunk_size, data_stripes);
4404 4404
4405 /* bump the answer up to a 16MB boundary */ 4405 /* bump the answer up to a 16MB boundary */
4406 stripe_size = (stripe_size + mask) & ~mask; 4406 stripe_size = (stripe_size + mask) & ~mask;
@@ -4412,10 +4412,10 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
4412 stripe_size = devices_info[ndevs-1].max_avail; 4412 stripe_size = devices_info[ndevs-1].max_avail;
4413 } 4413 }
4414 4414
4415 do_div(stripe_size, dev_stripes); 4415 stripe_size = div_u64(stripe_size, dev_stripes);
4416 4416
4417 /* align to BTRFS_STRIPE_LEN */ 4417 /* align to BTRFS_STRIPE_LEN */
4418 do_div(stripe_size, raid_stripe_len); 4418 stripe_size = div_u64(stripe_size, raid_stripe_len);
4419 stripe_size *= raid_stripe_len; 4419 stripe_size *= raid_stripe_len;
4420 4420
4421 map = kmalloc(map_lookup_size(num_stripes), GFP_NOFS); 4421 map = kmalloc(map_lookup_size(num_stripes), GFP_NOFS);
@@ -5135,7 +5135,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
5135 stripe_index = 0; 5135 stripe_index = 0;
5136 stripe_nr_orig = stripe_nr; 5136 stripe_nr_orig = stripe_nr;
5137 stripe_nr_end = ALIGN(offset + *length, map->stripe_len); 5137 stripe_nr_end = ALIGN(offset + *length, map->stripe_len);
5138 do_div(stripe_nr_end, map->stripe_len); 5138 stripe_nr_end = div_u64(stripe_nr_end, map->stripe_len);
5139 stripe_end_offset = stripe_nr_end * map->stripe_len - 5139 stripe_end_offset = stripe_nr_end * map->stripe_len -
5140 (offset + *length); 5140 (offset + *length);
5141 5141
@@ -5197,8 +5197,8 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
5197 ((rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) || 5197 ((rw & (REQ_WRITE | REQ_GET_READ_MIRRORS)) ||
5198 mirror_num > 1)) { 5198 mirror_num > 1)) {
5199 /* push stripe_nr back to the start of the full stripe */ 5199 /* push stripe_nr back to the start of the full stripe */
5200 stripe_nr = raid56_full_stripe_start; 5200 stripe_nr = div_u64(raid56_full_stripe_start,
5201 do_div(stripe_nr, stripe_len * nr_data_stripes(map)); 5201 stripe_len * nr_data_stripes(map));
5202 5202
5203 /* RAID[56] write or recovery. Return all stripes */ 5203 /* RAID[56] write or recovery. Return all stripes */
5204 num_stripes = map->num_stripes; 5204 num_stripes = map->num_stripes;
@@ -5534,11 +5534,11 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree,
5534 rmap_len = map->stripe_len; 5534 rmap_len = map->stripe_len;
5535 5535
5536 if (map->type & BTRFS_BLOCK_GROUP_RAID10) 5536 if (map->type & BTRFS_BLOCK_GROUP_RAID10)
5537 do_div(length, map->num_stripes / map->sub_stripes); 5537 length = div_u64(length, map->num_stripes / map->sub_stripes);
5538 else if (map->type & BTRFS_BLOCK_GROUP_RAID0) 5538 else if (map->type & BTRFS_BLOCK_GROUP_RAID0)
5539 do_div(length, map->num_stripes); 5539 length = div_u64(length, map->num_stripes);
5540 else if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) { 5540 else if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
5541 do_div(length, nr_data_stripes(map)); 5541 length = div_u64(length, nr_data_stripes(map));
5542 rmap_len = map->stripe_len * nr_data_stripes(map); 5542 rmap_len = map->stripe_len * nr_data_stripes(map);
5543 } 5543 }
5544 5544
@@ -5553,11 +5553,11 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree,
5553 continue; 5553 continue;
5554 5554
5555 stripe_nr = physical - map->stripes[i].physical; 5555 stripe_nr = physical - map->stripes[i].physical;
5556 do_div(stripe_nr, map->stripe_len); 5556 stripe_nr = div_u64(stripe_nr, map->stripe_len);
5557 5557
5558 if (map->type & BTRFS_BLOCK_GROUP_RAID10) { 5558 if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
5559 stripe_nr = stripe_nr * map->num_stripes + i; 5559 stripe_nr = stripe_nr * map->num_stripes + i;
5560 do_div(stripe_nr, map->sub_stripes); 5560 stripe_nr = div_u64(stripe_nr, map->sub_stripes);
5561 } else if (map->type & BTRFS_BLOCK_GROUP_RAID0) { 5561 } else if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
5562 stripe_nr = stripe_nr * map->num_stripes + i; 5562 stripe_nr = stripe_nr * map->num_stripes + i;
5563 } /* else if RAID[56], multiply by nr_data_stripes(). 5563 } /* else if RAID[56], multiply by nr_data_stripes().