Btrfs: Make btrfs_header_chunk_tree_uuid() return unsigned long
authorGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 20 Aug 2013 11:20:15 +0000 (13:20 +0200)
committerChris Mason <chris.mason@fusionio.com>
Sun, 1 Sep 2013 12:16:16 +0000 (08:16 -0400)
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>
fs/btrfs/ctree.c
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/ioctl.c

index 8e3efe3bad2413ad529530d4604ddb04dd96da98..5fa521bec07b367c79d66f1df50a23cb263de12d 100644 (file)
@@ -3111,8 +3111,7 @@ static noinline int insert_new_root(struct btrfs_trans_handle *trans,
                            BTRFS_FSID_SIZE);
 
        write_extent_buffer(c, root->fs_info->chunk_tree_uuid,
-                           (unsigned long)btrfs_header_chunk_tree_uuid(c),
-                           BTRFS_UUID_SIZE);
+                           btrfs_header_chunk_tree_uuid(c), BTRFS_UUID_SIZE);
 
        btrfs_set_node_key(c, &lower_key, 0);
        btrfs_set_node_blockptr(c, 0, lower->start);
@@ -3249,7 +3248,7 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
        write_extent_buffer(split, root->fs_info->fsid,
                            btrfs_header_fsid(split), BTRFS_FSID_SIZE);
        write_extent_buffer(split, root->fs_info->chunk_tree_uuid,
-                           (unsigned long)btrfs_header_chunk_tree_uuid(split),
+                           btrfs_header_chunk_tree_uuid(split),
                            BTRFS_UUID_SIZE);
 
        tree_mod_log_eb_copy(root->fs_info, split, c, 0, mid, c_nritems - mid);
@@ -4005,7 +4004,7 @@ again:
                            btrfs_header_fsid(right), BTRFS_FSID_SIZE);
 
        write_extent_buffer(right, root->fs_info->chunk_tree_uuid,
-                           (unsigned long)btrfs_header_chunk_tree_uuid(right),
+                           btrfs_header_chunk_tree_uuid(right),
                            BTRFS_UUID_SIZE);
 
        if (split == 0) {
index 1b8f5def29c7da16a98eaa4d71552fc3df108e87..c90be01cbe674daadbd98c940a29b6e3ddc9899c 100644 (file)
@@ -2680,10 +2680,9 @@ static inline unsigned long btrfs_header_fsid(struct extent_buffer *eb)
        return offsetof(struct btrfs_header, fsid);
 }
 
-static inline u8 *btrfs_header_chunk_tree_uuid(struct extent_buffer *eb)
+static inline unsigned long btrfs_header_chunk_tree_uuid(struct extent_buffer *eb)
 {
-       unsigned long ptr = offsetof(struct btrfs_header, chunk_tree_uuid);
-       return (u8 *)ptr;
+       return offsetof(struct btrfs_header, chunk_tree_uuid);
 }
 
 static inline int btrfs_is_leaf(struct extent_buffer *eb)
index d67a2ddb3ce6beb11d184d84d0f893646a1e7249..940bc486a0f8e1732e04a0660b4f0a41773be95c 100644 (file)
@@ -1294,7 +1294,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
        write_extent_buffer(leaf, fs_info->fsid, btrfs_header_fsid(leaf),
                            BTRFS_FSID_SIZE);
        write_extent_buffer(leaf, fs_info->chunk_tree_uuid,
-                           (unsigned long)btrfs_header_chunk_tree_uuid(leaf),
+                           btrfs_header_chunk_tree_uuid(leaf),
                            BTRFS_UUID_SIZE);
        btrfs_mark_buffer_dirty(leaf);
 
@@ -2629,8 +2629,7 @@ int open_ctree(struct super_block *sb,
        chunk_root->commit_root = btrfs_root_node(chunk_root);
 
        read_extent_buffer(chunk_root->node, fs_info->chunk_tree_uuid,
-          (unsigned long)btrfs_header_chunk_tree_uuid(chunk_root->node),
-          BTRFS_UUID_SIZE);
+          btrfs_header_chunk_tree_uuid(chunk_root->node), BTRFS_UUID_SIZE);
 
        ret = btrfs_read_chunk_tree(chunk_root);
        if (ret) {
index 41addd502bc96e0e1e3bfe474232c2a16bc0db8a..0ce93ac17f69390b6b66bb63457c3d9e2857bca6 100644 (file)
@@ -439,7 +439,7 @@ static noinline int create_subvol(struct inode *dir,
        write_extent_buffer(leaf, root->fs_info->fsid, btrfs_header_fsid(leaf),
                            BTRFS_FSID_SIZE);
        write_extent_buffer(leaf, root->fs_info->chunk_tree_uuid,
-                           (unsigned long)btrfs_header_chunk_tree_uuid(leaf),
+                           btrfs_header_chunk_tree_uuid(leaf),
                            BTRFS_UUID_SIZE);
        btrfs_mark_buffer_dirty(leaf);