Skip to contentSkip to conversation

btrfs: Remove done label in writepage_delalloc

PATCH In review Nikolay Borisov 3 participants 3 messages Jul 16, 2020 – Jul 17, 2020 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: Remove done label in writepage_delalloc

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

---
 fs/btrfs/extent_io.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
fs/btrfs/extent_io.c +2 -6
index a76b7da91aa6..e6d1d46ae384 100644
@@ -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

Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Nikolay Borisov

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

---
 fs/btrfs/extent_io.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
fs/btrfs/extent_io.c +1 -2
index a76b7da91aa6..e6d1d46ae384 100644
@@ -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

fs/btrfs/extent_io.c static noinline_for_stack int writepage_delalloc(struct btrfs_inode *inode, · line 3481

Quoted 9 lines
fs/btrfs/extent_io.c +1 -4
@@ -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

#2 lore raw
Quoted 36 lines · Johannes Thumshirn
Quoted 23 lines · Nikolay Borisov

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

---
 fs/btrfs/extent_io.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
fs/btrfs/extent_io.c +1 -2
index a76b7da91aa6..e6d1d46ae384 100644
@@ -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

fs/btrfs/extent_io.c static noinline_for_stack int writepage_delalloc(struct btrfs_inode *inode, · line 3481

Quoted 9 lines
fs/btrfs/extent_io.c +1 -4
@@ -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?

Quoted 1 line

/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.