public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Lukáš Czerner" <lczerner@redhat.com>
To: Jan Kara <jack@suse.cz>
Cc: Ted Tso <tytso@mit.edu>, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: Silence warning in ext4_writepages()
Date: Wed, 3 Jul 2013 12:07:25 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1307031204000.3892@localhost.localdomain> (raw)
In-Reply-To: <1372788869-24456-1-git-send-email-jack@suse.cz>

On Tue, 2 Jul 2013, Jan Kara wrote:

> Date: Tue,  2 Jul 2013 20:14:29 +0200
> From: Jan Kara <jack@suse.cz>
> To: Ted Tso <tytso@mit.edu>
> Cc: linux-ext4@vger.kernel.org, Jan Kara <jack@suse.cz>
> Subject: [PATCH] ext4: Silence warning in ext4_writepages()
> 
> 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.

Looks good.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/ext4/inode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 0188e65..19a1643 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -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;
> @@ -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;
> 

  reply	other threads:[~2013-07-03 10:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02 18:14 [PATCH] ext4: Silence warning in ext4_writepages() Jan Kara
2013-07-03 10:07 ` Lukáš Czerner [this message]
2013-07-06  1:58   ` Theodore Ts'o

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=alpine.LFD.2.00.1307031204000.3892@localhost.localdomain \
    --to=lczerner@redhat.com \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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