linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jones <dsj@fb.com>
To: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>, David Sterba <dsterba@suse.com>,
	<linux-btrfs@vger.kernel.org>
Subject: [v2] Re: btrfs: remove open-coded swap() in backref.c:__merge_refs
Date: Thu, 28 Jan 2016 15:28:35 -0500	[thread overview]
Message-ID: <20160128202834.GA31832@fb.com> (raw)
In-Reply-To: <20160128202556.GA31503@fb.com>

The kernel provides a swap() that does the same thing as this code.

Signed-off-by: Dave Jones <dsj@fb.com>

-- 
v2: Was swapping the same var. duh.

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index b90cd3776f8e..626bf6c12992 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -566,17 +566,14 @@ static void __merge_refs(struct list_head *head, int mode)
 		struct __prelim_ref *pos2 = pos1, *tmp;
 
 		list_for_each_entry_safe_continue(pos2, tmp, head, list) {
-			struct __prelim_ref *xchg, *ref1 = pos1, *ref2 = pos2;
+			struct __prelim_ref *ref1 = pos1, *ref2 = pos2;
 			struct extent_inode_elem *eie;
 
 			if (!ref_for_same_block(ref1, ref2))
 				continue;
 			if (mode == 1) {
-				if (!ref1->parent && ref2->parent) {
-					xchg = ref1;
-					ref1 = ref2;
-					ref2 = xchg;
-				}
+				if (!ref1->parent && ref2->parent)
+					swap(ref1, ref2);
 			} else {
 				if (ref1->parent != ref2->parent)
 					continue;

      reply	other threads:[~2016-01-28 20:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-28 20:25 btrfs: remove open-coded swap() in backref.c:__merge_refs Dave Jones
2016-01-28 20:28 ` Dave Jones [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160128202834.GA31832@fb.com \
    --to=dsj@fb.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).