Skip to content

Commit ae2f541

Browse files
Jens Axboechrismason-xx
authored andcommitted
btrfs: 32-bit type problems
An assorted set of casts to get rid of the warnings on 32-bit archs. Signed-off-by: Chris Mason <chris.mason@oracle.com>
1 parent 44b36eb commit ae2f541

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎fs/btrfs/ctree.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf)
13891389
ret = BTRFS_LEAF_DATA_SIZE(root) - leaf_space_used(leaf, 0, nritems);
13901390
if (ret < 0) {
13911391
printk("leaf free space ret %d, leaf data size %lu, used %d nritems %d\n",
1392-
ret, BTRFS_LEAF_DATA_SIZE(root),
1392+
ret, (unsigned long) BTRFS_LEAF_DATA_SIZE(root),
13931393
leaf_space_used(leaf, 0, nritems), nritems);
13941394
}
13951395
return ret;

‎fs/btrfs/extent-tree.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ struct btrfs_block_group_cache *btrfs_lookup_block_group(struct
149149
if (ret)
150150
return NULL;
151151

152-
block_group = (struct btrfs_block_group_cache *)ptr;
152+
block_group = (struct btrfs_block_group_cache *)(unsigned long)ptr;
153153

154154

155155
if (block_group->key.objectid <= bytenr && bytenr <=
@@ -279,7 +279,7 @@ struct btrfs_block_group_cache *btrfs_find_block_group(struct btrfs_root *root,
279279
if (ret)
280280
break;
281281

282-
cache = (struct btrfs_block_group_cache *)ptr;
282+
cache = (struct btrfs_block_group_cache *)(unsigned long)ptr;
283283
last = cache->key.objectid + cache->key.offset;
284284
used = btrfs_block_group_used(&cache->item);
285285

@@ -537,7 +537,7 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans,
537537
if (ret)
538538
break;
539539

540-
cache = (struct btrfs_block_group_cache *)ptr;
540+
cache = (struct btrfs_block_group_cache *)(unsigned long)ptr;
541541
err = write_one_cache_group(trans, root,
542542
path, cache);
543543
/*
@@ -1541,7 +1541,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
15411541
found_key.objectid + found_key.offset - 1,
15421542
bit | EXTENT_LOCKED, GFP_NOFS);
15431543
set_state_private(block_group_cache, found_key.objectid,
1544-
(u64)cache);
1544+
(unsigned long)cache);
15451545

15461546
if (key.objectid >=
15471547
btrfs_super_total_bytes(&info->super_copy))

‎fs/btrfs/extent_map.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,8 +2654,8 @@ void memcpy_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
26542654

26552655
cur = min(len, (unsigned long)(PAGE_CACHE_SIZE -
26562656
src_off_in_page));
2657-
cur = min(cur, (unsigned long)(PAGE_CACHE_SIZE -
2658-
dst_off_in_page));
2657+
cur = min_t(unsigned long, cur,
2658+
(unsigned long)(PAGE_CACHE_SIZE - dst_off_in_page));
26592659

26602660
copy_pages(extent_buffer_page(dst, dst_i),
26612661
extent_buffer_page(dst, src_i),
@@ -2707,7 +2707,7 @@ void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
27072707
if (dst_i == 0)
27082708
dst_off_in_page += start_offset;
27092709

2710-
cur = min(len, src_off_in_page + 1);
2710+
cur = min_t(unsigned long, len, src_off_in_page + 1);
27112711
cur = min(cur, dst_off_in_page + 1);
27122712
move_pages(extent_buffer_page(dst, dst_i),
27132713
extent_buffer_page(dst, src_i),

‎fs/btrfs/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static int insert_inline_extent(struct btrfs_trans_handle *trans,
188188
while (size > 0) {
189189
page = pages[i];
190190
kaddr = kmap_atomic(page, KM_USER0);
191-
cur_size = min(PAGE_CACHE_SIZE - page_offset, size);
191+
cur_size = min_t(size_t, PAGE_CACHE_SIZE - page_offset, size);
192192
write_extent_buffer(leaf, kaddr + page_offset, ptr, cur_size);
193193
kunmap_atomic(kaddr, KM_USER0);
194194
page_offset = 0;

‎fs/btrfs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
16061606
extent_start;
16071607
ptr = btrfs_file_extent_inline_start(item) + extent_offset;
16081608
map = kmap(page);
1609-
copy_size = min(PAGE_CACHE_SIZE - page_offset,
1609+
copy_size = min_t(u64, PAGE_CACHE_SIZE - page_offset,
16101610
size - extent_offset);
16111611

16121612
em->block_start = EXTENT_MAP_INLINE;

0 commit comments

Comments
 (0)