btrfs-progs: Make btrfs_header_chunk_tree_uuid() return unsigned long
authorRoss Kirk <ross.kirk@gmail.com>
Wed, 2 Oct 2013 12:28:27 +0000 (13:28 +0100)
committerChris Mason <clm@fb.com>
Fri, 31 Jan 2014 16:22:04 +0000 (08:22 -0800)
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.

From btrfs commit b308bc2f05a86e728bd035e21a4974acd05f4d1e

Signed-off-by: Ross Kirk <ross.kirk@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
btrfs-find-root.c
chunk-recover.c
cmds-check.c
ctree.c
ctree.h
disk-io.c
print-tree.c
utils.c

index 7572f52..0ba4c57 100644 (file)
@@ -112,8 +112,7 @@ static struct btrfs_root *open_ctree_broken(int fd, const char *device)
 
        eb = fs_info->chunk_root->node;
        read_extent_buffer(eb, fs_info->chunk_tree_uuid,
-                          (unsigned long)btrfs_header_chunk_tree_uuid(eb),
-                          BTRFS_UUID_SIZE);
+                          btrfs_header_chunk_tree_uuid(eb), BTRFS_UUID_SIZE);
 
        return fs_info->chunk_root;
 out_chunk:
index bcde39e..44e8b83 100644 (file)
@@ -1047,7 +1047,7 @@ static int __rebuild_chunk_root(struct btrfs_trans_handle *trans,
                        btrfs_header_fsid(), BTRFS_FSID_SIZE);
 
        write_extent_buffer(cow, root->fs_info->chunk_tree_uuid,
-                       (unsigned long)btrfs_header_chunk_tree_uuid(cow),
+                       btrfs_header_chunk_tree_uuid(cow),
                        BTRFS_UUID_SIZE);
 
        root->node = cow;
@@ -1235,7 +1235,7 @@ open_ctree_with_broken_chunk(struct recover_control *rc)
 
        eb = fs_info->tree_root->node;
        read_extent_buffer(eb, fs_info->chunk_tree_uuid,
-                          (unsigned long)btrfs_header_chunk_tree_uuid(eb),
+                          btrfs_header_chunk_tree_uuid(eb),
                           BTRFS_UUID_SIZE);
 
        return fs_info->fs_root;
index 43729a8..c15d8d0 100644 (file)
@@ -5697,7 +5697,7 @@ init:
                            btrfs_header_fsid(), BTRFS_FSID_SIZE);
 
        write_extent_buffer(c, root->fs_info->chunk_tree_uuid,
-                           (unsigned long)btrfs_header_chunk_tree_uuid(c),
+                           btrfs_header_chunk_tree_uuid(c),
                            BTRFS_UUID_SIZE);
 
        btrfs_mark_buffer_dirty(c);
diff --git a/ctree.c b/ctree.c
index fdb1bcb..2d4f773 100644 (file)
--- a/ctree.c
+++ b/ctree.c
@@ -1344,7 +1344,7 @@ static int noinline insert_new_root(struct btrfs_trans_handle *trans,
                            btrfs_header_fsid(), BTRFS_FSID_SIZE);
 
        write_extent_buffer(c, root->fs_info->chunk_tree_uuid,
-                           (unsigned long)btrfs_header_chunk_tree_uuid(c),
+                           btrfs_header_chunk_tree_uuid(c),
                            BTRFS_UUID_SIZE);
 
        btrfs_set_node_key(c, &lower_key, 0);
@@ -1463,7 +1463,7 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
        write_extent_buffer(split, root->fs_info->fsid,
                            btrfs_header_fsid(), 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);
 
 
@@ -2024,7 +2024,7 @@ again:
                            btrfs_header_fsid(), 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) {
diff --git a/ctree.h b/ctree.h
index 2117374..187026c 100644 (file)
--- a/ctree.h
+++ b/ctree.h
@@ -1794,10 +1794,9 @@ static inline unsigned long btrfs_header_fsid(void)
        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 u8 *btrfs_super_fsid(struct extent_buffer *eb)
index dc84a46..7eda2e1 100644 (file)
--- a/disk-io.c
+++ b/disk-io.c
@@ -1108,7 +1108,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path,
 
        eb = fs_info->chunk_root->node;
        read_extent_buffer(eb, fs_info->chunk_tree_uuid,
-                          (unsigned long)btrfs_header_chunk_tree_uuid(eb),
+                          btrfs_header_chunk_tree_uuid(eb),
                           BTRFS_UUID_SIZE);
 
        ret = btrfs_setup_all_roots(fs_info, root_tree_bytenr, flags);
index c52e5da..716f4d3 100644 (file)
@@ -199,7 +199,7 @@ static void print_uuids(struct extent_buffer *eb)
        uuid_unparse(disk_uuid, fs_uuid);
 
        read_extent_buffer(eb, disk_uuid,
-                          (unsigned long)btrfs_header_chunk_tree_uuid(eb),
+                          btrfs_header_chunk_tree_uuid(eb),
                           BTRFS_UUID_SIZE);
 
        chunk_uuid[BTRFS_UUID_UNPARSED_SIZE - 1] = '\0';
diff --git a/utils.c b/utils.c
index c46e09a..c1c55db 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -139,7 +139,7 @@ int make_btrfs(int fd, const char *device, const char *label,
        write_extent_buffer(buf, super.fsid, btrfs_header_fsid(),
                            BTRFS_FSID_SIZE);
 
-       write_extent_buffer(buf, chunk_tree_uuid, (unsigned long)
+       write_extent_buffer(buf, chunk_tree_uuid,
                            btrfs_header_chunk_tree_uuid(buf),
                            BTRFS_UUID_SIZE);