X-Spam-Checker-Version: SpamAssassin 3.4.0-r929098 (2010-03-30) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,J_CHICKENPOX_65 autolearn=no version=3.4.0-r929098 Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id p0P4RheB180683 for ; Mon, 24 Jan 2011 22:27:43 -0600 X-ASG-Debug-ID: 1295929804-2b64006c0000-NocioJ X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from ipmail04.adl6.internode.on.net (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id 835201A1D4EB for ; Mon, 24 Jan 2011 20:30:05 -0800 (PST) Received: from ipmail04.adl6.internode.on.net (ipmail04.adl6.internode.on.net [150.101.137.141]) by cuda.sgi.com with ESMTP id ufHEEvvkbGGGjfiQ for ; Mon, 24 Jan 2011 20:30:05 -0800 (PST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnwEAMPePU15LN5mgWdsb2JhbACkaxYBARYiJLtcDYVDBA Received: from ppp121-44-222-102.lns20.syd7.internode.on.net (HELO dastard) ([121.44.222.102]) by ipmail04.adl6.internode.on.net with ESMTP; 25 Jan 2011 15:00:03 +1030 Received: from dave by dastard with local (Exim 4.72) (envelope-from ) id 1PhaXb-0003Wi-4J; Tue, 25 Jan 2011 15:30:03 +1100 Date: Tue, 25 Jan 2011 15:30:03 +1100 From: Dave Chinner To: Christoph Hellwig Cc: xfs@oss.sgi.com X-ASG-Orig-Subj: Re: [PATCH 2/6] xfs: factor agf counter updates into a helper Subject: Re: [PATCH 2/6] xfs: factor agf counter updates into a helper Message-ID: <20110125043003.GJ11040@dastard> References: <20110121092227.115815324@bombadil.infradead.org> <20110121092550.694829728@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110121092550.694829728@bombadil.infradead.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-Barracuda-Connect: ipmail04.adl6.internode.on.net[150.101.137.141] X-Barracuda-Start-Time: 1295929806 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.2, rules version 3.2.2.53364 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on oss.sgi.com X-Virus-Status: Clean On Fri, Jan 21, 2011 at 04:22:29AM -0500, Christoph Hellwig wrote: > Updating the AGF/trans counters is duplicated between allocating and > freeing extents. Factor the code into a common helper. > > Signed-off-by: Christoph Hellwig Looks good, but one minor thing: > ASSERT(0); > /* NOTREACHED */ > } > - if (error) > + > + if (error || args->agbno == NULLAGBLOCK) > return error; > - /* > - * If the allocation worked, need to change the agf structure > - * (and log it), and the superblock. > - */ > - if (args->agbno != NULLAGBLOCK) { > - xfs_agf_t *agf; /* allocation group freelist header */ > - long slen = (long)args->len; > - > - ASSERT(args->len >= args->minlen && args->len <= args->maxlen); > - ASSERT(!(args->wasfromfl) || !args->isfl); > - ASSERT(args->agbno % args->alignment == 0); > - if (!(args->wasfromfl)) { > - > - agf = XFS_BUF_TO_AGF(args->agbp); > - be32_add_cpu(&agf->agf_freeblks, -(args->len)); > - xfs_trans_agblocks_delta(args->tp, > - -((long)(args->len))); > - args->pag->pagf_freeblks -= args->len; > - ASSERT(be32_to_cpu(agf->agf_freeblks) <= > - be32_to_cpu(agf->agf_length)); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The assert is lost in this path. > - xfs_alloc_log_agf(args->tp, args->agbp, > - XFS_AGF_FREEBLKS); > - /* > - * Search the busylist for these blocks and mark the > - * transaction as synchronous if blocks are found. This > - * avoids the need to block due to a synchronous log > - * force to ensure correct ordering as the synchronous > - * transaction will guarantee that for us. > - */ > - if (xfs_alloc_busy_search(args->mp, args->agno, > - args->agbno, args->len)) > - xfs_trans_set_sync(args->tp); > - } > - if (!args->isfl) > - xfs_trans_mod_sb(args->tp, > - args->wasdel ? XFS_TRANS_SB_RES_FDBLOCKS : > - XFS_TRANS_SB_FDBLOCKS, -slen); > - XFS_STATS_INC(xs_allocx); > - XFS_STATS_ADD(xs_allocb, args->len); > + > + ASSERT(args->len >= args->minlen); > + ASSERT(args->len <= args->maxlen); > + ASSERT(!args->wasfromfl || !args->isfl); > + ASSERT(args->agbno % args->alignment == 0); > + > + if (!args->wasfromfl) { > + xfs_alloc_update_counters(args->tp, args->pag, args->agbp, > + -((long)(args->len))); Perhaps catching the error here and adding an ASSERT(error == 0) would be a good idea. Otherwise, Reviewed-by: Dave Chinner -- Dave Chinner david@fromorbit.com