We only use this logic if our ref isn't a ref_head, so move it up into
the if (ref) case since we know that this is a normal ref and not a
delayed ref head.
Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
                        list_del(&ref->list);
                        if (!list_empty(&ref->add_list))
                                list_del(&ref->add_list);
-               }
-               atomic_dec(&delayed_refs->num_entries);
-
-               if (!btrfs_delayed_ref_is_head(ref)) {
                        /*
                         * when we play the delayed ref, also correct the
                         * ref_mod on head
                                WARN_ON(1);
                        }
                }
+               atomic_dec(&delayed_refs->num_entries);
+
                /*
                 * Record the must-insert_reserved flag before we drop the spin
                 * lock.