X-Spam-Checker-Version: SpamAssassin 3.3.0-rupdated (updated) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.0-rupdated Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by oss.sgi.com (8.12.11.20060308/8.12.11/SuSE Linux 0.7) with ESMTP id mBG6pIJb016812 for ; Tue, 16 Dec 2008 00:51:19 -0600 X-ASG-Debug-ID: 1229410277-12bb005e0000-NocioJ X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from sandeen.net (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id D3D5D173A30D for ; Mon, 15 Dec 2008 22:51:17 -0800 (PST) Received: from sandeen.net (sandeen.net [209.173.210.139]) by cuda.sgi.com with ESMTP id Q75xOdg57WzKWM7D for ; Mon, 15 Dec 2008 22:51:17 -0800 (PST) Received: from liberator.sandeen.net (liberator.sandeen.net [10.0.0.4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by sandeen.net (Postfix) with ESMTP id 237D4AABFC2; Tue, 16 Dec 2008 00:51:17 -0600 (CST) Message-ID: <49474FE4.2030500@sandeen.net> Date: Tue, 16 Dec 2008 00:51:16 -0600 From: Eric Sandeen User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) MIME-Version: 1.0 To: lachlan@sgi.com CC: xfs-oss X-ASG-Orig-Subj: Re: [PATCH] fix corruption case for block size < page size Subject: Re: [PATCH] fix corruption case for block size < page size References: <49435F35.40109@sandeen.net> <4943FCD7.2010509@sandeen.net> <494735D9.8020809@sgi.com> <49473F5C.3070308@sandeen.net> <49474530.2080809@sgi.com> <4947466D.7000705@sandeen.net> <494748FA.20404@sandeen.net> In-Reply-To: <494748FA.20404@sandeen.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Barracuda-Connect: sandeen.net[209.173.210.139] X-Barracuda-Start-Time: 1229410277 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.1.12847 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Eric Sandeen wrote: > Gah; or not. what is going on here... Doing just steps 1, 2, 3, 4 > (ending on the extending truncate): > > # xfs_io -c "pwrite -S 0x11 -b 4096 0 4096" -c "mmap -r 0 512" -c "mread > 0 512" -c "munmap" -c "truncate 256" -c "truncate 514" -t -d -f > /mnt/scratch/testfile > > # xfs_bmap -v /mnt/scratch/testfile > /mnt/scratch/testfile: > EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL > 0: [0..0]: 63..63 0 (63..63) 1 > 1: [1..1]: hole 1 > > It looks like what I expect, at this point. But then: > > # sync > # xfs_bmap -v /mnt/scratch/testfile > /mnt/scratch/testfile: > EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL > 0: [0..1]: 63..64 0 (63..64) 2 > > Um, why'd that last block get mapped in? mmap vs. direct IO I'm > guessing... w/o the mmap read this does not happen. Replying to myself twice? I really need to go to bed. So this all does seem to come back to page_state_convert. Both the extending write in the original case and the sync above find their way there; but esp. in the sync test above, why do we have *any* work to do? With a little instrumentation I see that for the truncate out; sync test above we get to xfs_vm_writepage() for a page which is *not* dirty, and yet we call page_state_convert on it and map in that 2nd block... Is that right!? I guess it is; ->write_cache_pages() clears dirty before calling writepage. Still why would this page be found dirty on this path. Bah. Bedtime. -Eric