[2/3] btrfs-progs: remove useless branch in __merge_refs
diff mbox

Message ID 20180424055233.6420-2-suy.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

Su Yue April 24, 2018, 5:52 a.m. UTC
After call of ref_for_same_block, ref1->parent must equals to
ref2->parent, the block of exchange is never reached.

So remove the block of exchange.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
 backref.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Qu Wenruo April 24, 2018, 6:09 a.m. UTC | #1
On 2018年04月24日 13:52, Su Yue wrote:
> After call of ref_for_same_block, ref1->parent must equals to
> ref2->parent, the block of exchange is never reached.
> 
> So remove the block of exchange.

Reviewed-by: Qu Wenruo <wqu@suse.com>

The patch looks good, but considering how much difference the kernel and
btrfs-progs have in backref.c, I think it would be much better to start
merging code for it.

Thanks,
Qu

> 
> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
> ---
>  backref.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/backref.c b/backref.c
> index c144dbf060f2..51553c702187 100644
> --- a/backref.c
> +++ b/backref.c
> @@ -497,7 +497,6 @@ static void __merge_refs(struct pref_state *prefstate, int mode)
>  		for (pos2 = pos1->next, n2 = pos2->next; pos2 != head;
>  		     pos2 = n2, n2 = pos2->next) {
>  			struct __prelim_ref *ref2;
> -			struct __prelim_ref *xchg;
>  			struct extent_inode_elem *eie;
>  
>  			ref2 = list_entry(pos2, struct __prelim_ref, list);
> @@ -505,11 +504,6 @@ static void __merge_refs(struct pref_state *prefstate, int mode)
>  			if (mode == 1) {
>  				if (!ref_for_same_block(ref1, ref2))
>  					continue;> -				if (!ref1->parent && ref2->parent) {
> -					xchg = ref1;
> -					ref1 = ref2;
> -					ref2 = xchg;
> -				}
>  			} else {
>  				if (ref1->parent != ref2->parent)
>  					continue;
>

Patch
diff mbox

diff --git a/backref.c b/backref.c
index c144dbf060f2..51553c702187 100644
--- a/backref.c
+++ b/backref.c
@@ -497,7 +497,6 @@  static void __merge_refs(struct pref_state *prefstate, int mode)
 		for (pos2 = pos1->next, n2 = pos2->next; pos2 != head;
 		     pos2 = n2, n2 = pos2->next) {
 			struct __prelim_ref *ref2;
-			struct __prelim_ref *xchg;
 			struct extent_inode_elem *eie;
 
 			ref2 = list_entry(pos2, struct __prelim_ref, list);
@@ -505,11 +504,6 @@  static void __merge_refs(struct pref_state *prefstate, int mode)
 			if (mode == 1) {
 				if (!ref_for_same_block(ref1, ref2))
 					continue;
-				if (!ref1->parent && ref2->parent) {
-					xchg = ref1;
-					ref1 = ref2;
-					ref2 = xchg;
-				}
 			} else {
 				if (ref1->parent != ref2->parent)
 					continue;