Skip to content

Commit

Permalink
ext4: silence warning in ext4_writepages()
Browse files Browse the repository at this point in the history
The loop in mpage_map_and_submit_extent() is guaranteed to always run
at least once since the caller of mpage_map_and_submit_extent() makes
sure map->m_len > 0. So make that explicit using do-while instead of
pure while which also silences the compiler warning about
uninitialized 'err' variable.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
  • Loading branch information
Jan Kara authored and Theodore Ts'o committed Jul 6, 2013
1 parent 6ae06ff commit 27d7c4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2163,7 +2163,7 @@ static int mpage_map_and_submit_extent(handle_t *handle,

mpd->io_submit.io_end->offset =
((loff_t)map->m_lblk) << inode->i_blkbits;
while (map->m_len) {
do {
err = mpage_map_one_extent(handle, mpd);
if (err < 0) {
struct super_block *sb = inode->i_sb;
Expand Down Expand Up @@ -2201,7 +2201,7 @@ static int mpage_map_and_submit_extent(handle_t *handle,
err = mpage_map_and_submit_buffers(mpd);
if (err < 0)
return err;
}
} while (map->m_len);

/* Update on-disk size after IO is submitted */
disksize = ((loff_t)mpd->first_page) << PAGE_CACHE_SHIFT;
Expand Down

0 comments on commit 27d7c4e

Please sign in to comment.