On Tue, Sep 11, 2018 at 01:57:36PM -0400, Josef Bacik wrote: > We pick the number of ref's to run based on the number of ref heads, and > only make the decision to stop once we've processed entire ref heads, so > only count the ref heads we've run and bail once we've hit the number of > ref heads we wanted to process.
Despite Nikolay's comment, it seems wrong to me to split this patch up from the previous one. After the first one, you have this nonsensical middle ground where the counter is number of heads but this counter is number of refs. > Signed-off-by: Josef Bacik <jo...@toxicpanda.com> > --- > fs/btrfs/extent-tree.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c > index 98f36dfeccb0..b32bd38390dd 100644 > --- a/fs/btrfs/extent-tree.c > +++ b/fs/btrfs/extent-tree.c > @@ -2592,6 +2592,7 @@ static noinline int __btrfs_run_delayed_refs(struct > btrfs_trans_handle *trans, > spin_unlock(&delayed_refs->lock); > break; > } > + count++; > > /* grab the lock that says we are going to process > * all the refs for this head */ > @@ -2605,7 +2606,6 @@ static noinline int __btrfs_run_delayed_refs(struct > btrfs_trans_handle *trans, > */ > if (ret == -EAGAIN) { > locked_ref = NULL; > - count++; > continue; > } > } > @@ -2633,7 +2633,6 @@ static noinline int __btrfs_run_delayed_refs(struct > btrfs_trans_handle *trans, > unselect_delayed_ref_head(delayed_refs, locked_ref); > locked_ref = NULL; > cond_resched(); > - count++; > continue; > } > > @@ -2651,7 +2650,6 @@ static noinline int __btrfs_run_delayed_refs(struct > btrfs_trans_handle *trans, > return ret; > } > locked_ref = NULL; > - count++; > continue; > } > > @@ -2702,7 +2700,6 @@ static noinline int __btrfs_run_delayed_refs(struct > btrfs_trans_handle *trans, > } > > btrfs_put_delayed_ref(ref); > - count++; > cond_resched(); > } > > -- > 2.14.3 >