Re: [PATCH 10/21] btrfs: breakout empty head cleanup to a helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 16, 2017 at 05:07:21PM +0300, Nikolay Borisov wrote:
> 
> 
> On 29.09.2017 22:43, Josef Bacik wrote:
> > Move this code out to a helper function to further simplivy
> > __btrfs_run_delayed_refs.
> > 
> > Signed-off-by: Josef Bacik <jbacik@xxxxxx>
> > ---
> >  fs/btrfs/extent-tree.c | 80 ++++++++++++++++++++++++++++----------------------
> >  1 file changed, 45 insertions(+), 35 deletions(-)
> > 
> > diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> > index f4048b23c7be..bae2eac11db7 100644
> > --- a/fs/btrfs/extent-tree.c
> > +++ b/fs/btrfs/extent-tree.c
> > @@ -2607,6 +2607,43 @@ static int cleanup_extent_op(struct btrfs_trans_handle *trans,
> >  	return ret ? ret : 1;
> >  }
> >  
> > +static int cleanup_ref_head(struct btrfs_trans_handle *trans,
> > +			    struct btrfs_fs_info *fs_info,
> > +			    struct btrfs_delayed_ref_head *head)
> > +{
> > +	struct btrfs_delayed_ref_root *delayed_refs;
> > +	int ret;
> > +
> > +	delayed_refs = &trans->transaction->delayed_refs;
> > +
> > +	ret = cleanup_extent_op(trans, fs_info, head);
> > +	if (ret < 0) {
> > +		unselect_delayed_ref_head(delayed_refs, head);
> > +		btrfs_debug(fs_info, "run_delayed_extent_op returned %d", ret);
> > +		return ret;
> > +	} else if (ret) {
> > +		return ret;
> > +	}
> nit: Omit the { } when there is a single statement after a conditional
> clause.

Unless it's a chain of if / if else / ... / else, then all statements
should use { }
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux