On Mon, Mar 17, 2014 at 01:28:04AM +0000, Al Viro wrote: > On Mon, Mar 17, 2014 at 12:29:18AM +0000, Al Viro wrote: > > > I think I know what's going on - O_DIRECT write starting a bit before > > EOF on a file with the last extent that can be grown. It fills > > a buffer_head with b_size extending quite a bit past the EOF; the > > blocks are really allocated. What causes the problem is that we > > have the flags set for the *first* block. IOW, buffer_new(bh) is > > false - the first block has already been allocated. And for > > direct-io.c it means "no zeroing the tail of the last block". > > BTW, that's something I have directly observed - xfs_get_blocks_direct() > called with iblock corresponding to a bit under 16Kb below EOF and > returning with ->b_size equal to 700K and ->b_flags not containing BH_New. What's the userspace IO pattern that triggers this? > IOW, we really can't mix new and old blocks in that interface - not enough > information is passed back to caller to be able to decide what does and > what does not need zeroing out. It should be either all-new or all-old. Right, and XFS should not be mixing old and new in the way you are describing, and that's what I can't reproduce. See my reply on the other thread. Probably best to continue there... > And it's not just the EOF, of course - the beginning of a hole in a sparse > file isn't any different from the end of file in that respect. Except that XFS treats that differently - it does allocation as unwritten extents there, and any mapping that covers an unwritten block will always result in buffer_new() getting set... Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs