linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: replace else-statement with initialization
@ 2023-05-02 14:51 Tom Rix
  2023-05-05 14:14 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Rix @ 2023-05-02 14:51 UTC (permalink / raw)
  To: clm, josef, dsterba; +Cc: linux-btrfs, linux-kernel, Tom Rix

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

Signed-off-by: Tom Rix <trix@redhat.com>
---
 fs/btrfs/ioctl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 25833b4eeaf5..4694301aa91e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -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);
 }
 
-- 
2.27.0


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

* Re: [PATCH] btrfs: replace else-statement with initialization
  2023-05-02 14:51 [PATCH] btrfs: replace else-statement with initialization Tom Rix
@ 2023-05-05 14:14 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2023-05-05 14:14 UTC (permalink / raw)
  To: Tom Rix; +Cc: clm, josef, dsterba, linux-btrfs, linux-kernel

On Tue, May 02, 2023 at 10:51:29AM -0400, Tom Rix wrote:
> A small optimization
> Move the default value of transid to its initialization
> and remove the else-statement.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Added to misc-next with minor updates, thanks.

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

end of thread, other threads:[~2023-05-05 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02 14:51 [PATCH] btrfs: replace else-statement with initialization Tom Rix
2023-05-05 14:14 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).