Received: with ECARTIS (v1.0.0; list xfs); Tue, 11 Dec 2007 20:03:27 -0800 (PST) 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,J_CHICKENPOX_42 autolearn=no version=3.3.0-r574664 Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.11.20060308/8.12.11/SuSE Linux 0.7) with SMTP id lBC43LaN007217 for ; Tue, 11 Dec 2007 20:03:24 -0800 Received: from [134.14.55.78] (redback.melbourne.sgi.com [134.14.55.78]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id PAA23564; Wed, 12 Dec 2007 15:03:23 +1100 Message-ID: <475F5DC3.6070203@sgi.com> Date: Wed, 12 Dec 2007 15:04:19 +1100 From: Lachlan McIlroy Reply-To: lachlan@sgi.com User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: Bhagi rathi CC: sgi.bugs.xfs@engr.sgi.com, xfs@oss.sgi.com Subject: Re: TAKE 964002 - Don't wait for pending I/Os when purging blocks beyond eof. References: <20071210055955.0F96358C4C34@chook.melbourne.sgi.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.91.2/5094/Tue Dec 11 18:55:35 2007 on oss.sgi.com X-Virus-Status: Clean X-archive-position: 13915 X-ecartis-version: Ecartis v1.0.0 Sender: xfs-bounce@oss.sgi.com Errors-to: xfs-bounce@oss.sgi.com X-original-sender: lachlan@sgi.com Precedence: bulk X-list: xfs Bhagi rathi wrote: > On Dec 10, 2007 11:29 AM, Lachlan McIlroy wrote: > >> Don't wait for pending I/Os when purging blocks beyond eof. >> >> On last close of a file we purge blocks beyond eof. The same >> code is used when we truncate the file size down. In this case >> we need to wait for any pending I/Os for dirty pages beyond the >> new eof. For the last close case we are not changing the file >> size and therefore do not need to wait for any I/Os to complete. >> This fixes a performance bottleneck where writes into the page >> cache and cache flushes can become mutually exclusive. > > > Lachlan, > > How the following is addressed if we don't wait for I/O to complete during > close of the file and > issue truncate: > > - We didn't waited for the I/O to complete > - Truncated blocks beyond EOF. > - These blocks are re-used for another transaction as meta-data. > - Meta-data flush was induced. However the flush of meta-data > reached first before the data I/O > because of some issues with under-lying driver. Later the file I/O > over-written the meta-data I/O. > We have corruption of data. This case will not happen. For a truncate down we may have dirty pages beyond eof that are in the process of being written to disk while we are trying to shrink the file - we need to wait for those. In the case of truncating blocks beyond eof on last close we are not changing the file size and so there cannot be pages beyond eof. Any I/O that may be in progress will be within the file size and not to any of the blocks we are trying to free. > > It seems the corruption could be in various ways. Isn't this the reason why > truncate has to wait > for the I/O to complete? Corruption could certainly occur if we don't wait for I/O. I think the reason this code was added was to synchronize with direct I/O unwritten extent conversions which could occur after the direct writer thread has released the iolock and so we can't use the iolock alone as an I/O barrier. > I believe fundamental problem is once the blocks > are free'ed, the re-association should > not expect some I/O in concurrent to those same block addresses. > > -Cheers, > Bhagi. > > >> >> Date: Mon Dec 10 16:59:09 AEDT 2007 >> Workarea: redback.melbourne.sgi.com:/home/lachlan/isms/2.6.x-vniowait >> Inspected by: pleckie >> Author: lachlan >> >> The following file(s) were checked into: >> longdrop.melbourne.sgi.com:/isms/linux/2.6.x-xfs-melb >> >> >> Modid: xfs-linux-melb:xfs-kern:30220a >> fs/xfs/xfs_inode.c - 1.489 - changed http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/>> xfs_inode.c.diff?r1=text&tr1=1.489&r2=text&tr2=1.488&f=h > http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/> xfs_inode.c.diff?r1=text&tr1=1.489&r2=text&tr2=1.488&f=h >> http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/xfs_inode.c.diff?r1=text&tr1=1.489&r2=text&tr2=1.488&f=h >> - Don't wait for pending I/Os when purging blocks beyond eof. >> >> >> >> >> > > > [[HTML alternate version deleted]] > > >