Current code will always truncate tailing page if its alloc_start is smaller than inode size.
This behavior will cause a lot of unneeded COW page size extent. This patch will avoid such problem. Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- v2: Newly introduced --- fs/btrfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index d638d34..ad30b37 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2640,7 +2640,7 @@ static long btrfs_fallocate(struct file *file, int mode, alloc_start); if (ret) goto out; - } else { + } else if (offset + len > inode->i_size) { /* * If we are fallocating from the end of the file onward we * need to zero out the end of the page if i_size lands in the -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html