3.19rc1, extent_io.c:2193:13: warning: cast to pointer from integer of different size
I get this when building on i686:
CC [M] fs/btrfs/extent_io.ofs/btrfs/extent_io.c: In function ‘btrfs_free_io_failure_record’:fs/btrfs/extent_io.c:2193:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
failrec = (struct io_failure_record *)state->private;
.config contains the followingCONFIG_BTRFS_FS=mCONFIG_BTRFS_FS_POSIX_ACL=y
# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set
# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not setCONFIG_BTRFS_DEBUG=yCONFIG_BTRFS_ASSERT=y
Signature · 1 line
Chris Murphy
PATCH 1/1 btrfs: suppress a build warning on building 32bit kernel
From: Satoru Takeuchi <[email protected]>
Suppress the following warning displayed on building 32bit (i686) kernel.
===============================================================================
...
CC [M] fs/btrfs/extent_io.ofs/btrfs/extent_io.c: In function ‘btrfs_free_io_failure_record’:fs/btrfs/extent_io.c:2193:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
failrec = (struct io_failure_record *)state->private;
...
===============================================================================
--- fs/btrfs/extent_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent_io.c +1 -1
@@ -2190,7 +2190,7 @@ void btrfs_free_io_failure_record(struct inode *inode, u64 start, u64 end) next =next_state (state); - failrec = (struct io_failure_record *)state->private; + failrec = (struct io_failure_record *)(unsigned long )state->private;free_extent_state (state);kfree (failrec);
Signature · 1 line
1.8.3.1
Re: [PATCH] btrfs: suppress a build warning on building 32bit kernel
fs/btrfs/extent_io.c void btrfs_free_io_failure_record(struct inode *inode, u64 start, u64 end) · line 2193
Quoted 9 lines · Satoru Takeuchi
From: Satoru Takeuchi <[email protected]>
fs/btrfs/extent_io.c +1
-1@@ -2190,7 +2190,7 @@ void btrfs_free_io_failure_record(struct inode *inode, u64 start, u64 end) next =next_state (state); - failrec = (struct io_failure_record *)state->private; + failrec = (struct io_failure_record *)(unsigned long )state->private;
We're always using the 'private' data to store a pointer to 'struct io_failure_record *', please change the defintion in 'struct extent_state' instead of the typecasting.
Quoted 2 lines
fs/btrfs/extent_io.c +0
-0free_extent_state (state);kfree (failrec);
Re: [PATCH] btrfs: suppress a build warning on building 32bit kernel
Hi David,
Quoted 6 lines · David Sterba
Quoted 5 lines · Satoru Takeuchi
From: Satoru Takeuchi <[email protected]>
fs/btrfs/extent_io.c +0
-0@@ -2190,7 +2190,7 @@ void btrfs_free_io_failure_record(struct inode *inode, u64 start, u64 end)
Quoted 8 lines
fs/btrfs/extent_io.c void btrfs_free_io_failure_record(struct inode *inode, u64 start, u64 end) · line 2193
Quoted 4 lines
fs/btrfs/extent_io.c +1
-1next =next_state (state); - failrec = (struct io_failure_record *)state->private; + failrec = (struct io_failure_record *)(unsigned long )state->private;We're always using the 'private' data to store a pointer to 'struct
io_failure_record*', please change the defintion in 'structextent_state' instead of the typecasting.
Current definition is as follow.
===============================================================================
struct extent_state {
...
/* for use by the FS */
u64 private;
};===============================================================================
It it OK to changing "u64 private" to "struct io_failure_record *failrec" and change "{set,get}_state_private()" to "{set,get}_state_failrec()? Or is it better to keep the name "private" as is and just change its type to "unsigned long" or "(void *)"?
Thanks,
Satoru
Quoted 3 lines
Quoted 3 lines
fs/btrfs/extent_io.c +0
-0free_extent_state (state);kfree (failrec);
Re: [PATCH] btrfs: suppress a build warning on building 32bit kernel
Quoted 15 lines · Satoru Takeuchi
Quoted 6 lines
fs/btrfs/extent_io.c void btrfs_free_io_failure_record(struct inode *inode, u64 start, u64 end) · line 2193
Quoted 2 lines
fs/btrfs/extent_io.c +1
-1- failrec = (struct io_failure_record *)state->private; + failrec = (struct io_failure_record *)(unsigned long )state->private;We're always using the 'private' data to store a pointer to 'struct
io_failure_record*', please change the defintion in 'structextent_state' instead of the typecasting.Current definition is as follow.
===============================================================================
structextent_state{
.../* for use by the FS */ u64 private; };
Quoted 6 lines
===============================================================================
It it OK to changing "u64 private" to "struct
io_failure_record*failrec" and change "{set,get}_state_private()" to "{set,get}_state_failrec()? Or is it better to keep the name "private" as is and just change its type to "unsigned long" or "(void *)"?
I've looked at the implied changes that set/get functions renaming would need, also to keep the code sane. It does not seem to be small enough to fold in this patch so please go on with adding the typecasts. The code could use some cleanups but bugfixes first.