* btrfs: remove open-coded swap() in backref.c:__merge_refs
@ 2016-01-28 20:25 Dave Jones
2016-01-28 20:28 ` [v2] " Dave Jones
0 siblings, 1 reply; 2+ messages in thread
From: Dave Jones @ 2016-01-28 20:25 UTC (permalink / raw)
To: Chris Mason; +Cc: Josef Bacik, David Sterba, linux-btrfs
The kernel provides a swap() that does the same thing as this code.
Signed-off-by: Dave Jones <dsj@fb.com>
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, ref1);
} else {
if (ref1->parent != ref2->parent)
continue;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [v2] Re: btrfs: remove open-coded swap() in backref.c:__merge_refs
2016-01-28 20:25 btrfs: remove open-coded swap() in backref.c:__merge_refs Dave Jones
@ 2016-01-28 20:28 ` Dave Jones
0 siblings, 0 replies; 2+ messages in thread
From: Dave Jones @ 2016-01-28 20:28 UTC (permalink / raw)
To: Chris Mason; +Cc: Josef Bacik, David Sterba, linux-btrfs
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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-28 20:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-28 20:25 btrfs: remove open-coded swap() in backref.c:__merge_refs Dave Jones
2016-01-28 20:28 ` [v2] " Dave Jones
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).