Skip to contentSkip to conversation

btrfs: replace else-statement with initialization

PATCH In review Tom Rix 2 participants 2 messages May 2, 2023 – May 5, 2023 Btrfs file system

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 btrfs: replace else-statement with initialization

A small optimization
Move the default value of transid to its initialization and remove the else-statement.

---
 fs/btrfs/ioctl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/btrfs/ioctl.c +2 -3
index 25833b4eeaf5..4694301aa91e 100644
@@ -3132,14 +3132,13 @@ static noinline long btrfs_ioctl_start_sync(struct btrfs_root *root,
 static noinline long btrfs_ioctl_wait_sync(struct btrfs_fs_info *fs_info,
 					   void __user *argp)
 {
-	u64 transid;
+	u64 transid = 0;  /* current trans */
 
 	if (argp) {
 		if (copy_from_user(&transid, argp, sizeof(transid)))
 			return -EFAULT;
-	} else {
-		transid = 0;  /* current trans */
 	}
+
 	return btrfs_wait_for_commit(fs_info, transid);
 }
 
Signature · 1 line
2.27.0
#1 lore raw
Quoted 5 lines · Tom Rix

A small optimization
Move the default value of transid to its initialization and remove the else-statement.

Added to misc-next with minor updates, thanks.