Re: [PATCH v2] fstests: generic: Check if a bull fallocate will change extent number

Dave Chinner
2015-09-29T21:51:39Z

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.
--
Dave Chinner
david@fromorbit.com