public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Niv Sardi <xaiki@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] Move xfs_attr_rolltrans to xfs_trans_roll
Date: Thu, 26 Jun 2008 04:28:27 -0400	[thread overview]
Message-ID: <20080626082827.GC23954@infradead.org> (raw)
In-Reply-To: <1214196150-5427-3-git-send-email-xaiki@sgi.com>

> -		if ((error = xfs_attr_rolltrans(&args.trans, dp)))
> +
> +		error = xfs_trans_roll(&args.trans, dp);
> +		if (error)
>  			goto out;
>  
>  	}
> @@ -1019,7 +1021,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
>  		 * Commit the current trans (including the inode) and start
>  		 * a new one.
>  		 */
> -		if ((error = xfs_attr_rolltrans(&args->trans, dp)))
> +		if ((error = xfs_trans_roll(&args->trans, dp)))

Please do the transformation to move all assignments out of the
coditionals everywhere.

> index b08e2a2..9465807 100644
> --- a/fs/xfs/xfs_attr_leaf.c
> +++ b/fs/xfs/xfs_attr_leaf.c
> @@ -2543,7 +2543,7 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args)
>  	/*
>  	 * Commit the flag value change and start the next trans in series.
>  	 */
> -	error = xfs_attr_rolltrans(&args->trans, args->dp);
> +	error = xfs_trans_roll(&args->trans, args->dp);
>  
>  	return(error);

	return xfs_trans_roll(&args->trans, args->dp);

> +/*
> + * Roll from one trans in the sequence of PERMANENT transactions to the next.
> + */

The comment could be a little more verbose :)

> +int
> +xfs_trans_roll(
> +	xfs_trans_t	**tpp,
> +	xfs_inode_t	*dp)
> +{
> +	xfs_trans_t	*trans;
> +	unsigned int	logres, count;
> +	int		error;

Please convert this to the struct types and canonical variable names
for the given types:

int
xfs_trans_roll(
	struct xfs_trans	*tpp,
	struct xfs_inode	*ip)
{
	struct xfs_trans	*tp;


> +	if ((error = xfs_trans_commit(trans, 0)))
> +		return (error);

	error = xfs_trans_commit(trans, 0);
	if (error)
		return error;

> +	error = xfs_trans_reserve(trans, 0, logres, 0,
> +				  XFS_TRANS_PERM_LOG_RES, count);
> +	/*
> +	 *  Ensure that the inode is in the new transaction and locked.
> +	 */
> +	if (!error) {
> +		xfs_trans_ijoin(trans, dp, XFS_ILOCK_EXCL);
> +		xfs_trans_ihold(trans, dp);
> +	}
> +	return (error);

	if (error)
		return error;

	xfs_trans_ijoin(trans, ip, XFS_ILOCK_EXCL);
	xfs_trans_ihold(trans, ip);
	return 0;

  parent reply	other threads:[~2008-06-26  8:27 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-23  4:42 [RFC] Create with EA initial work Niv Sardi
2008-06-23  4:42 ` [PATCH] Move attr log alloc size calculator to another function Niv Sardi
2008-06-23  4:42   ` [PATCH] Move xfs_attr_rolltrans to xfs_trans_roll Niv Sardi
2008-06-23  4:42     ` [PATCH] Introduce xfs_trans_bmap_add_attrfork Niv Sardi
2008-06-23  4:42       ` [PATCH] Give a transaction to xfs_attr_set_int Niv Sardi
2008-06-29 22:08         ` Dave Chinner
2008-07-01 15:49           ` Josef 'Jeff' Sipek
2008-06-26  9:28       ` [PATCH] Introduce xfs_trans_bmap_add_attrfork Christoph Hellwig
2008-06-27  4:42         ` Niv Sardi
2008-07-02  8:25           ` Timothy Shimmin
2008-07-02 23:39             ` Niv Sardi
2008-06-29 22:02       ` Dave Chinner
2008-06-26  8:28     ` Christoph Hellwig [this message]
2008-06-27  4:44       ` [PATCH] Move xfs_attr_rolltrans to xfs_trans_roll Niv Sardi
2008-06-27 13:03         ` Christoph Hellwig
2008-06-27 13:03           ` Christoph Hellwig
2008-07-02  7:14     ` Timothy Shimmin
2008-06-26  8:24   ` [PATCH] Move attr log alloc size calculator to another function Christoph Hellwig
2008-06-27  4:49     ` Niv Sardi
2008-07-02  6:38       ` Timothy Shimmin
2008-07-10  7:39 ` [UPDATED RFC] Create with EA initial work Niv Sardi
2008-07-10  7:39   ` [PATCH] Move attr log alloc size calculator to another function Niv Sardi
2008-07-10  7:39     ` [PATCH] Move xfs_attr_rolltrans to xfs_trans_roll Niv Sardi
2008-07-10  7:39       ` [PATCH] Introduce xfs_bmap_add_attrfork_trans Niv Sardi
2008-07-10  7:39         ` [PATCH] Give a transaction to xfs_attr_set_int Niv Sardi
2008-07-11  5:38           ` [PATCH] Export xfs_attr_set_int_trans Niv Sardi
2008-07-11  5:38             ` [PATCH] hack to test create + ea Niv Sardi
2008-07-22  4:43             ` [PATCH] Export xfs_attr_set_int_trans Christoph Hellwig
2008-07-22  6:06               ` Niv Sardi
2008-07-23  7:46                 ` Christoph Hellwig
2008-07-11  5:44           ` [PATCH] Give a transaction to xfs_attr_set_int Niv Sardi
2008-07-11  5:59             ` Christoph Hellwig
2008-07-23  7:58         ` [PATCH] Introduce xfs_bmap_add_attrfork_trans Christoph Hellwig
2008-07-22  4:38   ` [UPDATED RFC] Create with EA initial work Christoph Hellwig
2008-07-23  5:35     ` Niv Sardi
2008-07-23  7:51       ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080626082827.GC23954@infradead.org \
    --to=hch@infradead.org \
    --cc=xaiki@sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox