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.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.4.0-r929098 Received: from cuda.sgi.com (cuda1.sgi.com [192.48.157.11]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id p64BG9j7141432 for ; Mon, 4 Jul 2011 06:16:10 -0500 X-ASG-Debug-ID: 1309778167-2bcd039e0000-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 D55C8E714BA for ; Mon, 4 Jul 2011 04:16:07 -0700 (PDT) Received: from bombadil.infradead.org (173-166-109-252-newengland.hfc.comcastbusiness.net [173.166.109.252]) by cuda.sgi.com with ESMTP id zi4n5F8u5l0XJBny for ; Mon, 04 Jul 2011 04:16:07 -0700 (PDT) Received: from hch by bombadil.infradead.org with local (Exim 4.76 #1 (Red Hat Linux)) id 1Qdh8H-000563-Qp; Mon, 04 Jul 2011 11:16:05 +0000 Date: Mon, 4 Jul 2011 07:16:05 -0400 From: Christoph Hellwig To: Dave Chinner Cc: xfs@oss.sgi.com X-ASG-Orig-Subj: Re: [PATCH 2/5] xfs: use a cursor for bulk AIL insertion Subject: Re: [PATCH 2/5] xfs: use a cursor for bulk AIL insertion Message-ID: <20110704111605.GA5513@infradead.org> References: <1309757260-5484-1-git-send-email-david@fromorbit.com> <1309757260-5484-3-git-send-email-david@fromorbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1309757260-5484-3-git-send-email-david@fromorbit.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html X-Barracuda-Connect: 173-166-109-252-newengland.hfc.comcastbusiness.net[173.166.109.252] X-Barracuda-Start-Time: 1309778168 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: -1.92 X-Barracuda-Spam-Status: No, SCORE=-1.92 using per-user scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.1 tests=RDNS_DYNAMIC X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.67939 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_DYNAMIC Delivered to trusted network by host with dynamic-looking rDNS X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on oss.sgi.com X-Virus-Status: Clean > + do { > + /* no placeholder, so get our insert location */ > + if (!lip) > + lip = __xfs_trans_ail_cursor_last(ailp, cur, > + lsn, false); > + > + if (!lip) { > + /* > + * The list is empty, so just splice and return. Our > + * cursor is already guaranteed to be up to date, so we > + * don't need to touch it here. > + */ > + list_splice(list, &ailp->xa_ail); > + return; > + } > + > + /* The placeholder was invalidated, need to get a new cursor */ > + if ((__psint_t)lip & 1) > + lip = NULL; > + > + } while (lip == NULL); Why do we even need a loop here? Given that we're under xa_lock no new cursor will get invalidated. Isn't the simple code below equivalent? /* no valid placeholder, get us a useful one */ if (!lip || (__psint_t)lip & 1)) lip = __xfs_trans_ail_cursor_last(ailp, cur, lsn, false); if (!lip) { /* * The list is empty, so just splice and return. Our * cursor is already guaranteed to be up to date, so we * don't need to touch it here. */ list_splice(list, &ailp->xa_ail); return; }