* [PATCH] ext4: fix some warnings from sparse check introduced by COLLAPSE_RANGE patches
@ 2014-04-12 9:16 Zheng Liu
2014-04-12 17:23 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Zheng Liu @ 2014-04-12 9:16 UTC (permalink / raw)
To: linux-ext4; +Cc: Theodore Ts'o, Andreas Dilger, Namjae Jeon, Zheng Liu
From: Zheng Liu <wenqing.lz@taobao.com>
This commit tries to fix some byte order issues that is found by sparse
check.
$ make M=fs/ext4 C=2 CF=-D__CHECK_ENDIAN__
...
CHECK fs/ext4/extents.c
fs/ext4/extents.c:5232:41: warning: restricted __le32 degrades to integer
fs/ext4/extents.c:5236:52: warning: bad assignment (-=) to restricted __le32
fs/ext4/extents.c:5258:45: warning: bad assignment (-=) to restricted __le32
fs/ext4/extents.c:5303:28: warning: restricted __le32 degrades to integer
fs/ext4/extents.c:5318:18: warning: incorrect type in assignment (different base types)
fs/ext4/extents.c:5318:18: expected unsigned int [unsigned] [usertype] ex_start
fs/ext4/extents.c:5318:18: got restricted __le32 [usertype] ee_block
fs/ext4/extents.c:5319:24: warning: restricted __le32 degrades to integer
fs/ext4/extents.c:5334:31: warning: incorrect type in assignment (different base types)
...
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
fs/ext4/extents.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 82df3ce..1867af6 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5229,11 +5229,11 @@ ext4_ext_shift_path_extents(struct ext4_ext_path *path, ext4_lblk_t shift,
if (ex_start == EXT_FIRST_EXTENT(path[depth].p_hdr))
update = 1;
- *start = ex_last->ee_block +
+ *start = le32_to_cpu(ex_last->ee_block) +
ext4_ext_get_actual_len(ex_last);
while (ex_start <= ex_last) {
- ex_start->ee_block -= shift;
+ le32_add_cpu(&ex_start->ee_block, -shift);
if (ex_start >
EXT_FIRST_EXTENT(path[depth].p_hdr)) {
if (ext4_ext_try_to_merge_right(inode,
@@ -5255,7 +5255,7 @@ ext4_ext_shift_path_extents(struct ext4_ext_path *path, ext4_lblk_t shift,
if (err)
goto out;
- path[depth].p_idx->ei_block -= shift;
+ le32_add_cpu(&path[depth].p_idx->ei_block, -shift);
err = ext4_ext_dirty(handle, inode, path + depth);
if (err)
goto out;
@@ -5300,7 +5300,8 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
return ret;
}
- stop_block = extent->ee_block + ext4_ext_get_actual_len(extent);
+ stop_block = le32_to_cpu(extent->ee_block) +
+ ext4_ext_get_actual_len(extent);
ext4_ext_drop_refs(path);
kfree(path);
@@ -5315,8 +5316,9 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
path = ext4_ext_find_extent(inode, start - 1, NULL, 0);
depth = path->p_depth;
extent = path[depth].p_ext;
- ex_start = extent->ee_block;
- ex_end = extent->ee_block + ext4_ext_get_actual_len(extent);
+ ex_start = le32_to_cpu(extent->ee_block);
+ ex_end = le32_to_cpu(extent->ee_block) +
+ ext4_ext_get_actual_len(extent);
ext4_ext_drop_refs(path);
kfree(path);
@@ -5331,7 +5333,7 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
return PTR_ERR(path);
depth = path->p_depth;
extent = path[depth].p_ext;
- current_block = extent->ee_block;
+ current_block = le32_to_cpu(extent->ee_block);
if (start > current_block) {
/* Hole, move to the next extent */
ret = mext_next_extent(inode, path, &extent);
--
1.7.9.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ext4: fix some warnings from sparse check introduced by COLLAPSE_RANGE patches
2014-04-12 9:16 [PATCH] ext4: fix some warnings from sparse check introduced by COLLAPSE_RANGE patches Zheng Liu
@ 2014-04-12 17:23 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2014-04-12 17:23 UTC (permalink / raw)
To: Zheng Liu; +Cc: linux-ext4, Andreas Dilger, Namjae Jeon, Zheng Liu
On Sat, Apr 12, 2014 at 05:16:18PM +0800, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
>
> This commit tries to fix some byte order issues that is found by sparse
> check.
>
> $ make M=fs/ext4 C=2 CF=-D__CHECK_ENDIAN__
> ...
> CHECK fs/ext4/extents.c
> fs/ext4/extents.c:5232:41: warning: restricted __le32 degrades to integer
> fs/ext4/extents.c:5236:52: warning: bad assignment (-=) to restricted __le32
> fs/ext4/extents.c:5258:45: warning: bad assignment (-=) to restricted __le32
> fs/ext4/extents.c:5303:28: warning: restricted __le32 degrades to integer
> fs/ext4/extents.c:5318:18: warning: incorrect type in assignment (different base types)
> fs/ext4/extents.c:5318:18: expected unsigned int [unsigned] [usertype] ex_start
> fs/ext4/extents.c:5318:18: got restricted __le32 [usertype] ee_block
> fs/ext4/extents.c:5319:24: warning: restricted __le32 degrades to integer
> fs/ext4/extents.c:5334:31: warning: incorrect type in assignment (different base types)
> ...
>
> Cc: "Theodore Ts'o" <tytso@mit.edu>
> Cc: Andreas Dilger <adilger.kernel@dilger.ca>
> Cc: Namjae Jeon <namjae.jeon@samsung.com>
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Thanks, queued for the 3.15 bugfix push.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-12 17:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-12 9:16 [PATCH] ext4: fix some warnings from sparse check introduced by COLLAPSE_RANGE patches Zheng Liu
2014-04-12 17:23 ` Theodore Ts'o
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).