kernelbuild test bot complained about a 64bit % operation in the patch
btrfs: add support for multiple global roots
Fix this using div64_u64_rem. This can be folded in to the original
patch.
Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -2452,6 +2452,7 @@ void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans)
static u64 calculate_global_root_id(struct btrfs_fs_info *fs_info, u64 offset)
{
u64 div = SZ_1G;
+ u64 index;
if (!btrfs_fs_incompat(fs_info, EXTENT_TREE_V2))
return BTRFS_FIRST_CHUNK_TREE_OBJECTID;
@@ -2460,7 +2461,9 @@ static u64 calculate_global_root_id(struct btrfs_fs_info *fs_info, u64 offset)
if (btrfs_super_total_bytes(fs_info->super_copy) <= (SZ_1G * 10ULL))
div = SZ_128M;
- return (div_u64(offset, div) % fs_info->nr_global_roots);
+ offset = div64_u64(offset, div);
+ div64_u64_rem(offset, fs_info->nr_global_roots, &index);
+ return index;
}
struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *trans,