Received: with ECARTIS (v1.0.0; list xfs); Thu, 26 Jun 2008 01:27:29 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.0-r574664 (2007-09-11) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.0-r574664 Received: from cuda.sgi.com (cuda1.sgi.com [192.48.168.28]) by oss.sgi.com (8.12.11.20060308/8.12.11/SuSE Linux 0.7) with ESMTP id m5Q8RRAS008925 for ; Thu, 26 Jun 2008 01:27:27 -0700 X-ASG-Debug-ID: 1214468907-5cf8011e0000-NocioJ X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from bombadil.infradead.org (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id 67CBAD57375; Thu, 26 Jun 2008 01:28:28 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) by cuda.sgi.com with ESMTP id sSurp77qOcB4ImLJ; Thu, 26 Jun 2008 01:28:28 -0700 (PDT) Received: from hch by bombadil.infradead.org with local (Exim 4.68 #1 (Red Hat Linux)) id 1KBmqB-0001aD-Kq; Thu, 26 Jun 2008 08:28:27 +0000 Date: Thu, 26 Jun 2008 04:28:27 -0400 From: Christoph Hellwig To: Niv Sardi Cc: xfs@oss.sgi.com X-ASG-Orig-Subj: Re: [PATCH] Move xfs_attr_rolltrans to xfs_trans_roll Subject: Re: [PATCH] Move xfs_attr_rolltrans to xfs_trans_roll Message-ID: <20080626082827.GC23954@infradead.org> References: <1214196150-5427-1-git-send-email-xaiki@sgi.com> <1214196150-5427-2-git-send-email-xaiki@sgi.com> <1214196150-5427-3-git-send-email-xaiki@sgi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1214196150-5427-3-git-send-email-xaiki@sgi.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html X-Barracuda-Connect: bombadil.infradead.org[18.85.46.34] X-Barracuda-Start-Time: 1214468908 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Virus-Scanned: by cuda.sgi.com at sgi.com X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.1 tests= X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54372 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Virus-Scanned: ClamAV 0.91.2/6021/Wed Feb 27 15:55:48 2008 on oss.sgi.com X-Virus-Status: Clean X-archive-position: 16561 X-ecartis-version: Ecartis v1.0.0 Sender: xfs-bounce@oss.sgi.com Errors-to: xfs-bounce@oss.sgi.com X-original-sender: hch@infradead.org Precedence: bulk X-list: xfs > - 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;