Received: with ECARTIS (v1.0.0; list xfs); Thu, 26 Jun 2008 21:13:01 -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.4 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 m5R4Ctsj001274 for ; Thu, 26 Jun 2008 21:12:55 -0700 X-ASG-Debug-ID: 1214540035-3b9001310000-NocioJ X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from ipmail04.adl2.internode.on.net (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id 5C1C7D63698 for ; Thu, 26 Jun 2008 21:13:55 -0700 (PDT) Received: from ipmail04.adl2.internode.on.net (ipmail04.adl2.internode.on.net [203.16.214.57]) by cuda.sgi.com with ESMTP id Ngs1AMMWazh0BcRK for ; Thu, 26 Jun 2008 21:13:55 -0700 (PDT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEANexXkh5LFnm/2dsb2JhbACuPg X-IronPort-AV: E=Sophos;i="4.27,713,1204464600"; d="scan'208";a="144183943" Received: from ppp121-44-89-230.lns10.syd6.internode.on.net (HELO disturbed) ([121.44.89.230]) by ipmail04.adl2.internode.on.net with ESMTP; 27 Jun 2008 13:43:52 +0930 Received: from dave by disturbed with local (Exim 4.69) (envelope-from ) id 1KC5LL-0001At-9V; Fri, 27 Jun 2008 14:13:51 +1000 Date: Fri, 27 Jun 2008 14:13:51 +1000 From: Dave Chinner To: Matthew Wilcox Cc: xfs@oss.sgi.com, linux-kernel@vger.kernel.org X-ASG-Orig-Subj: Re: [PATCH 2/6] Replace inode flush semaphore with a completion Subject: Re: [PATCH 2/6] Replace inode flush semaphore with a completion Message-ID: <20080627041351.GY29319@disturbed> Mail-Followup-To: Matthew Wilcox , xfs@oss.sgi.com, linux-kernel@vger.kernel.org References: <1214455277-6387-1-git-send-email-david@fromorbit.com> <1214455277-6387-3-git-send-email-david@fromorbit.com> <20080627023011.GC7703@parisc-linux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080627023011.GC7703@parisc-linux.org> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Barracuda-Connect: ipmail04.adl2.internode.on.net[203.16.214.57] X-Barracuda-Start-Time: 1214540036 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.54451 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: 16593 X-ecartis-version: Ecartis v1.0.0 Sender: xfs-bounce@oss.sgi.com Errors-to: xfs-bounce@oss.sgi.com X-original-sender: david@fromorbit.com Precedence: bulk X-list: xfs On Thu, Jun 26, 2008 at 08:30:11PM -0600, Matthew Wilcox wrote: > On Thu, Jun 26, 2008 at 02:41:13PM +1000, Dave Chinner wrote: > > Use the new completion flush code to implement the inode > > flush lock. Removes one of the final users of semaphores > > in the XFS code base. > > Let's demonstrate converting this one to completions ... Great. I need all the help I can get. ;) > > --- a/fs/xfs/xfs_iget.c > > +++ b/fs/xfs/xfs_iget.c > > @@ -216,7 +216,7 @@ finish_inode: > > mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino); > > init_waitqueue_head(&ip->i_ipin_wait); > > atomic_set(&ip->i_pincount, 0); > > - initnsema(&ip->i_flock, 1, "xfsfino"); > > + init_completion_flush(&ip->i_flush); > > + init_completion(&ip->i_flush); > + complete(&ip->i_flush); Ok, that would work. Need commenting, though. > > int > > xfs_iflock_nowait(xfs_inode_t *ip) > > { > > - return (cpsema(&(ip->i_flock))); > > + return completion_flush_start_nowait(&ip->i_flush); > > This is where you need a new function ... > > + return nowait_for_completion(&ip->i_flush); > > Yes, we probably need a better name for the down_trylock() equivalent. I suggested try_wait_for_completion() in a different email - it's a difficult on to say "a wait_for_completion() call that doesn't wait".... I think I'll stick with the try_.... version to match other "try" operations. > > int > > @@ -3070,7 +3069,7 @@ xfs_iflush( > > XFS_STATS_INC(xs_iflush_count); > > > > ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); > > - ASSERT(issemalocked(&(ip->i_flock))); > > + ASSERT(completion_flush_inprogress(&ip->i_flush)); > > is_complete()? That's a little to general for my liking - I note that there are already an existing is_complete() function in a driver. completion_done() perhaps? Cheers, Dave. -- Dave Chinner david@fromorbit.com