summary refs log tree commit diff
path: root/fs/xfs
diff options
context:
space:
mode:
authorZeng Heng <zengheng4@huawei.com>2022-09-19 06:50:14 +1000
committerDave Chinner <david@fromorbit.com>2022-09-19 06:50:14 +1000
commita0ebf8c46d64ba96b413784f88af0a4dca95b6bc (patch)
tree6f24470af854e3ea141bb5227593e6465977bc08 /fs/xfs
parentde94a2e151bed6884b4f21aa518a100ac9e83af2 (diff)
downloadlinux-a0ebf8c46d64ba96b413784f88af0a4dca95b6bc.tar.gz
xfs: simplify if-else condition in xfs_reflink_trim_around_shared
"else" is not generally useful after a return,
so remove it for clean code.

There is no logical changes.

Signed-off-by: Zeng Heng <zengheng4@huawei.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>

Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_reflink.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 251f20ddd368..93bdd25680bc 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -200,7 +200,9 @@ xfs_reflink_trim_around_shared(
 	if (fbno == NULLAGBLOCK) {
 		/* No shared blocks at all. */
 		return 0;
-	} else if (fbno == agbno) {
+	}
+
+	if (fbno == agbno) {
 		/*
 		 * The start of this extent is shared.  Truncate the
 		 * mapping at the end of the shared region so that a
@@ -210,16 +212,16 @@ xfs_reflink_trim_around_shared(
 		irec->br_blockcount = flen;
 		*shared = true;
 		return 0;
-	} else {
-		/*
-		 * There's a shared extent midway through this extent.
-		 * Truncate the mapping at the start of the shared
-		 * extent so that a subsequent iteration starts at the
-		 * start of the shared region.
-		 */
-		irec->br_blockcount = fbno - agbno;
-		return 0;
 	}
+
+	/*
+	 * There's a shared extent midway through this extent.
+	 * Truncate the mapping at the start of the shared
+	 * extent so that a subsequent iteration starts at the
+	 * start of the shared region.
+	 */
+	irec->br_blockcount = fbno - agbno;
+	return 0;
 }
 
 int