Message ID | 1444702827-18169-20-git-send-email-quwenruo@cn.fujitsu.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 35bfabf..e59b123 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
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 <quwenruo@cn.fujitsu.com> --- v2: Newly introduced v3: None --- fs/btrfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)