btrfs: simplify transid initialization in btrfs_ioctl_wait_sync
authorTom Rix <trix@redhat.com>
Tue, 2 May 2023 14:51:29 +0000 (10:51 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2023 11:59:23 +0000 (13:59 +0200)
A small code simplification, move the default value of transid to its
initialization and remove the else-statement.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c

index 9522669000a7711bb3a392c6299b7c768df1eb2f..df7603c3068628104c0a3f389f5b0607253d8dfc 100644 (file)
@@ -3133,14 +3133,13 @@ out:
 static noinline long btrfs_ioctl_wait_sync(struct btrfs_fs_info *fs_info,
                                           void __user *argp)
 {
-       u64 transid;
+       /* By default wait for the current transaction. */
+       u64 transid = 0;
 
-       if (argp) {
+       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);
 }