public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: Remove done label in writepage_delalloc
@ 2020-07-16 15:17 Nikolay Borisov
  2020-07-17  7:31 ` Johannes Thumshirn
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Borisov @ 2020-07-16 15:17 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

Since there is not common cleanup run after the label it makes it somewhat
redundant.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/extent_io.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index a76b7da91aa6..e6d1d46ae384 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3445,8 +3445,7 @@ static noinline_for_stack int writepage_delalloc(struct btrfs_inode *inode,
 			 * started, so we don't want to return > 0 unless
 			 * things are going well.
 			 */
-			ret = ret < 0 ? ret : -EIO;
-			goto done;
+			return ret < 0 ? ret : -EIO;
 		}
 		/*
 		 * delalloc_end is already one less than the total length, so
@@ -3478,10 +3477,7 @@ static noinline_for_stack int writepage_delalloc(struct btrfs_inode *inode,
 		return 1;
 	}

-	ret = 0;
-
-done:
-	return ret;
+	return 0;
 }

 /*
--
2.17.1


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

* Re: [PATCH] btrfs: Remove done label in writepage_delalloc
  2020-07-16 15:17 [PATCH] btrfs: Remove done label in writepage_delalloc Nikolay Borisov
@ 2020-07-17  7:31 ` Johannes Thumshirn
  2020-07-17 10:34   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Thumshirn @ 2020-07-17  7:31 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs@vger.kernel.org

On 16/07/2020 17:17, Nikolay Borisov wrote:
> Since there is not common cleanup run after the label it makes it somewhat
> redundant.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  fs/btrfs/extent_io.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index a76b7da91aa6..e6d1d46ae384 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -3445,8 +3445,7 @@ static noinline_for_stack int writepage_delalloc(struct btrfs_inode *inode,
>  			 * started, so we don't want to return > 0 unless
>  			 * things are going well.
>  			 */
> -			ret = ret < 0 ? ret : -EIO;
> -			goto done;
> +			return ret < 0 ? ret : -EIO;
>  		}
>  		/*
>  		 * delalloc_end is already one less than the total length, so
> @@ -3478,10 +3477,7 @@ static noinline_for_stack int writepage_delalloc(struct btrfs_inode *inode,
>  		return 1;
>  	}
> 
> -	ret = 0;
> -
> -done:
> -	return ret;
> +	return 0;
>  }

I thought David doesn't like direct returns in loops?

/me thinks this is easier to understand though

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> 

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

* Re: [PATCH] btrfs: Remove done label in writepage_delalloc
  2020-07-17  7:31 ` Johannes Thumshirn
@ 2020-07-17 10:34   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2020-07-17 10:34 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: Nikolay Borisov, linux-btrfs@vger.kernel.org

On Fri, Jul 17, 2020 at 07:31:22AM +0000, Johannes Thumshirn wrote:
> On 16/07/2020 17:17, Nikolay Borisov wrote:
> > Since there is not common cleanup run after the label it makes it somewhat
> > redundant.
> > 
> > Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> > ---
> >  fs/btrfs/extent_io.c | 8 ++------
> >  1 file changed, 2 insertions(+), 6 deletions(-)
> > 
> > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> > index a76b7da91aa6..e6d1d46ae384 100644
> > --- a/fs/btrfs/extent_io.c
> > +++ b/fs/btrfs/extent_io.c
> > @@ -3445,8 +3445,7 @@ static noinline_for_stack int writepage_delalloc(struct btrfs_inode *inode,
> >  			 * started, so we don't want to return > 0 unless
> >  			 * things are going well.
> >  			 */
> > -			ret = ret < 0 ? ret : -EIO;
> > -			goto done;
> > +			return ret < 0 ? ret : -EIO;
> >  		}
> >  		/*
> >  		 * delalloc_end is already one less than the total length, so
> > @@ -3478,10 +3477,7 @@ static noinline_for_stack int writepage_delalloc(struct btrfs_inode *inode,
> >  		return 1;
> >  	}
> > 
> > -	ret = 0;
> > -
> > -done:
> > -	return ret;
> > +	return 0;
> >  }
> 
> I thought David doesn't like direct returns in loops?
> 
> /me thinks this is easier to understand though

I don't but try to evaluate each patch if it makes sense and the code is
readable and does not diverge too much from patterns we have elsewhere.
This one looks ok, so I'll add it to misc-next.

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

end of thread, other threads:[~2020-07-17 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-16 15:17 [PATCH] btrfs: Remove done label in writepage_delalloc Nikolay Borisov
2020-07-17  7:31 ` Johannes Thumshirn
2020-07-17 10:34   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox