diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-11-02 09:52:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-12 05:39:35 -0500 |
commit | a299abd230818ceb4e68520ba2f442194267cc50 (patch) | |
tree | 32850b000701a6754cc8a6b9b5b5f1403acb1853 /fs | |
parent | 725ba1a3ebc49478f76dea369563a79c86546fbd (diff) |
f2fs: hide a maybe-uninitialized warning
commit 230436b3ef3fd7d4a1da19edf5e87bb2d74e0fc2 upstream.
gcc is unsure about the use of last_ofs_in_node, which might happen
without a prior initialization:
fs/f2fs//git/arm-soc/fs/f2fs/data.c: In function ‘f2fs_map_blocks’:
fs/f2fs/data.c:799:54: warning: ‘last_ofs_in_node’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (prealloc && dn.ofs_in_node != last_ofs_in_node + 1) {
As pointed out by Chao Yu, the code is actually correct as 'prealloc'
is only set if the last_ofs_in_node has been set, the two always
get updated together.
This initializes last_ofs_in_node to dn.ofs_in_node for each
new dnode at the start of the 'next_block' loop, which at that
point is a correct initialization as well. I assume that compilers
that correctly track the contents of the variables and do not
warn about the condition also figure out that they can eliminate
the extra assignment here.
Fixes: 46008c6d4232 ("f2fs: support in batch multi blocks preallocation")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/data.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 9ae194fd2fdb..14db4b712021 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -716,7 +716,7 @@ next_dnode: | |||
716 | } | 716 | } |
717 | 717 | ||
718 | prealloc = 0; | 718 | prealloc = 0; |
719 | ofs_in_node = dn.ofs_in_node; | 719 | last_ofs_in_node = ofs_in_node = dn.ofs_in_node; |
720 | end_offset = ADDRS_PER_PAGE(dn.node_page, inode); | 720 | end_offset = ADDRS_PER_PAGE(dn.node_page, inode); |
721 | 721 | ||
722 | next_block: | 722 | next_block: |