linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Silence warning in ext4_writepages()
@ 2013-07-02 18:14 Jan Kara
  2013-07-03 10:07 ` Lukáš Czerner
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2013-07-02 18:14 UTC (permalink / raw)
  To: Ted Tso; +Cc: linux-ext4, Jan Kara

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>
---
 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;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: Silence warning in ext4_writepages()
  2013-07-02 18:14 [PATCH] ext4: Silence warning in ext4_writepages() Jan Kara
@ 2013-07-03 10:07 ` Lukáš Czerner
  2013-07-06  1:58   ` Theodore Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Lukáš Czerner @ 2013-07-03 10:07 UTC (permalink / raw)
  To: Jan Kara; +Cc: Ted Tso, linux-ext4

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;
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: Silence warning in ext4_writepages()
  2013-07-03 10:07 ` Lukáš Czerner
@ 2013-07-06  1:58   ` Theodore Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2013-07-06  1:58 UTC (permalink / raw)
  To: Lukáš Czerner; +Cc: Jan Kara, linux-ext4

On Wed, Jul 03, 2013 at 12:07:25PM +0200, Lukáš Czerner wrote:
> 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>

Applied, thanks.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-06  1:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-02 18:14 [PATCH] ext4: Silence warning in ext4_writepages() Jan Kara
2013-07-03 10:07 ` Lukáš Czerner
2013-07-06  1:58   ` 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).