summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Kirk <ross.kirk@gmail.com>2013-10-02 13:28:27 +0100
committerChris Mason <clm@fb.com>2014-01-31 08:22:04 -0800
commit7ff512ce38a266756442ddca328090fe9b6781dc (patch)
tree2834e555523e45037322e4ff300e4562be4d6a43
parent1ecefced86538306d581b05105a93d1268ce0028 (diff)
btrfs-progs: 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. 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>
-rw-r--r--btrfs-find-root.c3
-rw-r--r--chunk-recover.c4
-rw-r--r--cmds-check.c2
-rw-r--r--ctree.c6
-rw-r--r--ctree.h5
-rw-r--r--disk-io.c2
-rw-r--r--print-tree.c2
-rw-r--r--utils.c2
8 files changed, 12 insertions, 14 deletions
diff --git a/btrfs-find-root.c b/btrfs-find-root.c
index 7572f520..0ba4c575 100644
--- a/btrfs-find-root.c
+++ b/btrfs-find-root.c
@@ -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:
diff --git a/chunk-recover.c b/chunk-recover.c
index bcde39e2..44e8b833 100644
--- a/chunk-recover.c
+++ b/chunk-recover.c
@@ -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;
diff --git a/cmds-check.c b/cmds-check.c
index 43729a88..c15d8d03 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -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 fdb1bcbf..2d4f773b 100644
--- 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 2117374b..187026cc 100644
--- 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)
diff --git a/disk-io.c b/disk-io.c
index dc84a468..7eda2e12 100644
--- 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);
diff --git a/print-tree.c b/print-tree.c
index c52e5da0..716f4d37 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -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 c46e09a4..c1c55db4 100644
--- 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);