linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Chris Mason <chris.mason@fusionio.com>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH 09/12] Btrfs: Make btrfs_header_chunk_tree_uuid() return unsigned long
Date: Tue, 20 Aug 2013 13:20:15 +0200	[thread overview]
Message-ID: <1376997618-13573-10-git-send-email-geert@linux-m68k.org> (raw)
In-Reply-To: <1376997618-13573-1-git-send-email-geert@linux-m68k.org>

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>
---
 fs/btrfs/ctree.c   |    7 +++----
 fs/btrfs/ctree.h   |    5 ++---
 fs/btrfs/disk-io.c |    5 ++---
 fs/btrfs/ioctl.c   |    2 +-
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 9e3b259..a93d0c7 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3143,8 +3143,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);
@@ -3281,7 +3280,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);
@@ -4037,7 +4036,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) {
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 509963a..f54be20 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2608,10 +2608,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)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4b61698..4a6c0e5 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1288,7 +1288,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);
 
@@ -2607,8 +2607,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) {
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 593a0ec..a39034e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -428,7 +428,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);
 
-- 
1.7.9.5


  parent reply	other threads:[~2013-08-20 11:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20 11:20 [PATCH 00/12] Btrfs: cast cleanups Geert Uytterhoeven
2013-08-20 11:20 ` [PATCH 01/12] Btrfs: Remove superfluous casts from u64 to unsigned long long Geert Uytterhoeven
2013-08-20 14:16   ` Eric Sandeen
2013-08-20 14:17     ` Eric Sandeen
2013-08-20 11:20 ` [PATCH 02/12] Btrfs: Make BTRFS_DEV_REPLACE_DEVID an unsigned long long constant Geert Uytterhoeven
2013-08-20 11:20 ` [PATCH 03/12] Btrfs: Format PAGE_SIZE as unsigned long Geert Uytterhoeven
2013-08-20 11:20 ` [PATCH 04/12] Btrfs: Format mirror_num as int Geert Uytterhoeven
2013-08-20 11:20 ` [PATCH 05/12] Btrfs: Make btrfs_device_uuid() return unsigned long Geert Uytterhoeven
2013-08-20 11:20 ` [PATCH 06/12] Btrfs: Make btrfs_device_fsid() " Geert Uytterhoeven
2013-08-20 11:20 ` [PATCH 07/12] Btrfs: Make btrfs_dev_extent_chunk_tree_uuid() " Geert Uytterhoeven
2013-08-20 11:20 ` [PATCH 08/12] Btrfs: Make btrfs_header_fsid() " Geert Uytterhoeven
2013-08-20 11:20 ` Geert Uytterhoeven [this message]
2013-08-20 11:20 ` [PATCH 10/12] Btrfs: PAGE_CACHE_SIZE is already " Geert Uytterhoeven
2013-08-20 11:20 ` [PATCH 11/12] Btrfs: Do not truncate sector_t on 32-bit with CONFIG_LBDAF=y Geert Uytterhoeven
2013-08-20 11:20 ` [PATCH 12/12] Btrfs: Use %z to format size_t Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376997618-13573-10-git-send-email-geert@linux-m68k.org \
    --to=geert@linux-m68k.org \
    --cc=chris.mason@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).