From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: with ECARTIS (v1.0.0; list xfs); Tue, 06 Nov 2007 12:41:14 -0800 (PST) Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with SMTP id lA6Kf6iY013333 for ; Tue, 6 Nov 2007 12:41:10 -0800 Date: Wed, 7 Nov 2007 07:41:00 +1100 From: David Chinner Subject: Re: TAKE 972756 - Implement fallocate. Message-ID: <20071106204100.GW995458@sgi.com> References: <20071102024314.9BF3458C38F7@chook.melbourne.sgi.com> <20071106001223.GY66820511@sgi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: xfs-bounce@oss.sgi.com Errors-to: xfs-bounce@oss.sgi.com List-Id: xfs To: Bhagi rathi Cc: David Chinner , xfs@oss.sgi.com On Tue, Nov 06, 2007 at 10:57:03PM +0530, Bhagi rathi wrote: > File is of size 1k. A 4k block is allocated as file-system block size is > 4k. > Preallocation happened from 1k to 256k. Now, it looks to me that we have > un-written extents from 4k to 256k. There is no guarantee that data from 1k > to 4k is all zero'es. Fallocate is updating size. Hence on subsequent read, > we can get garbage from 1k to 4k and all zero'es from 4k to 256k # rm /mnt/test/fred # xfs_io -f -c "pwrite 0 1024" -c "fsync" -c "falloc_allocsp 0 262144" -c "bmap -vp" /mnt/test/fred wrote 1024/1024 bytes at offset 0 1 KiB, 1 ops; 0.0000 sec (42.459 MiB/sec and 43478.2609 ops/sec) /mnt/test/fred: EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL FLAGS 0: [0..7]: 14520..14527 0 (14520..14527) 8 00000 1: [8..511]: 345688..346191 0 (345688..346191) 504 10000 # dd if=/mnt/test/fred bs=4k count=1 |od -Ax 1+0 records in 1+0 records out 4096 bytes (4.1 kB) copied, 0.004566 seconds, 897 kB/s 000000 146715 146715 146715 146715 146715 146715 146715 146715 * 000400 000000 000000 000000 000000 000000 000000 000000 000000 * 001000 Only 1k of modified data, then 3k of zeros, then a bunch of unwritten extents out to EOF. Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group