Hi Dave, I updated the patch and moved it to btrfs.
But I still has some question about the fallocate behavior.
Just as the new btrfs test case, I changed the fallocate range, not to
cover the last part, to make the problem more obvious:
Btrfs will truncate beyond EOF even that's *not covered* by the
fallocate range.
It's OK for a fs to modify the extent layout during fallocate, but is it
OK to modify extent layout completely *out* of the fallocate range?
Thanks,
Qu
在 2015年09月30日 05:51, Dave Chinner 写道:
On Tue, Sep 29, 2015 at 05:34:24PM +0800, Qu Wenruo wrote:
Normally, a bull fallocate call on a fully written and synced file
should not add an extent.
Why not? Filesystems can do whatever they want with extents during
a fallocate call. e.g. if the blocks are shared, then fallocate
might break the block sharing so future overwrites don't get
ENOSPC. This is a requirement set down by posix_fallocate(3)
"After a successful call to posix_fallocate(), subsequent writes to
bytes in the specified range are guaranteed not to fail because of
lack of disk space."
Hence if you've got a file with shared blocks, a "full fallocate"
must change the extent layout to break the sharing. As such, the
premise of this test is wrong.
That's not to say that btrfs has a bug:
Btrfs has a bug to always truncate the last page if the fallocate start
offset is smaller than inode size.
But it' not clear that this behaviour is actually a bug if it's not
changing the file data.
Cheers,
Dave.
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html