Skip to content

Commit b308bc2

Browse files
geertuChris Mason
authored andcommitted
Btrfs: Make btrfs_header_chunk_tree_uuid() return unsigned long
Internally, btrfs_header_chunk_tree_uuid() calculates an unsigned long, but casts it to a pointer, while all callers cast it to unsigned long again. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
1 parent fba6aa7 commit b308bc2

4 files changed

Lines changed: 8 additions & 11 deletions

File tree

‎fs/btrfs/ctree.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3111,8 +3111,7 @@ static noinline int insert_new_root(struct btrfs_trans_handle *trans,
31113111
BTRFS_FSID_SIZE);
31123112

31133113
write_extent_buffer(c, root->fs_info->chunk_tree_uuid,
3114-
(unsigned long)btrfs_header_chunk_tree_uuid(c),
3115-
BTRFS_UUID_SIZE);
3114+
btrfs_header_chunk_tree_uuid(c), BTRFS_UUID_SIZE);
31163115

31173116
btrfs_set_node_key(c, &lower_key, 0);
31183117
btrfs_set_node_blockptr(c, 0, lower->start);
@@ -3249,7 +3248,7 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
32493248
write_extent_buffer(split, root->fs_info->fsid,
32503249
btrfs_header_fsid(split), BTRFS_FSID_SIZE);
32513250
write_extent_buffer(split, root->fs_info->chunk_tree_uuid,
3252-
(unsigned long)btrfs_header_chunk_tree_uuid(split),
3251+
btrfs_header_chunk_tree_uuid(split),
32533252
BTRFS_UUID_SIZE);
32543253

32553254
tree_mod_log_eb_copy(root->fs_info, split, c, 0, mid, c_nritems - mid);
@@ -4005,7 +4004,7 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans,
40054004
btrfs_header_fsid(right), BTRFS_FSID_SIZE);
40064005

40074006
write_extent_buffer(right, root->fs_info->chunk_tree_uuid,
4008-
(unsigned long)btrfs_header_chunk_tree_uuid(right),
4007+
btrfs_header_chunk_tree_uuid(right),
40094008
BTRFS_UUID_SIZE);
40104009

40114010
if (split == 0) {

‎fs/btrfs/ctree.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2680,10 +2680,9 @@ static inline unsigned long btrfs_header_fsid(struct extent_buffer *eb)
26802680
return offsetof(struct btrfs_header, fsid);
26812681
}
26822682

2683-
static inline u8 *btrfs_header_chunk_tree_uuid(struct extent_buffer *eb)
2683+
static inline unsigned long btrfs_header_chunk_tree_uuid(struct extent_buffer *eb)
26842684
{
2685-
unsigned long ptr = offsetof(struct btrfs_header, chunk_tree_uuid);
2686-
return (u8 *)ptr;
2685+
return offsetof(struct btrfs_header, chunk_tree_uuid);
26872686
}
26882687

26892688
static inline int btrfs_is_leaf(struct extent_buffer *eb)

‎fs/btrfs/disk-io.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
12941294
write_extent_buffer(leaf, fs_info->fsid, btrfs_header_fsid(leaf),
12951295
BTRFS_FSID_SIZE);
12961296
write_extent_buffer(leaf, fs_info->chunk_tree_uuid,
1297-
(unsigned long)btrfs_header_chunk_tree_uuid(leaf),
1297+
btrfs_header_chunk_tree_uuid(leaf),
12981298
BTRFS_UUID_SIZE);
12991299
btrfs_mark_buffer_dirty(leaf);
13001300

@@ -2629,8 +2629,7 @@ int open_ctree(struct super_block *sb,
26292629
chunk_root->commit_root = btrfs_root_node(chunk_root);
26302630

26312631
read_extent_buffer(chunk_root->node, fs_info->chunk_tree_uuid,
2632-
(unsigned long)btrfs_header_chunk_tree_uuid(chunk_root->node),
2633-
BTRFS_UUID_SIZE);
2632+
btrfs_header_chunk_tree_uuid(chunk_root->node), BTRFS_UUID_SIZE);
26342633

26352634
ret = btrfs_read_chunk_tree(chunk_root);
26362635
if (ret) {

‎fs/btrfs/ioctl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ static noinline int create_subvol(struct inode *dir,
439439
write_extent_buffer(leaf, root->fs_info->fsid, btrfs_header_fsid(leaf),
440440
BTRFS_FSID_SIZE);
441441
write_extent_buffer(leaf, root->fs_info->chunk_tree_uuid,
442-
(unsigned long)btrfs_header_chunk_tree_uuid(leaf),
442+
btrfs_header_chunk_tree_uuid(leaf),
443443
BTRFS_UUID_SIZE);
444444
btrfs_mark_buffer_dirty(leaf);
445445

0 commit comments

Comments
 (0)