aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2014-04-14 22:41:00 -0400
committerChris Mason <clm@fb.com>2014-04-24 19:43:32 -0400
commitc5f7d0bb29df2e1848a236e58e201daf5b4e0f21 (patch)
tree00190de63e0573193302449e3df0d13cc467ac41 /fs
parent0040e606e35a0db80fc3fac04ccc7c7176a8e2b1 (diff)
btrfs: Change the hole range to a more accurate value.
Commit 3ac0d7b96a268a98bd474cab8bce3a9f125aaccf fixed the btrfs expanding write problem but the hole punched is sometimes too large for some iovec, which has unmapped data ranges. This patch will change to hole range to a more accurate value using the counts checked by the write check routines. Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 23f6a9d9f104..e7e78fa9085e 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1783,7 +1783,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
1783 start_pos = round_down(pos, root->sectorsize); 1783 start_pos = round_down(pos, root->sectorsize);
1784 if (start_pos > i_size_read(inode)) { 1784 if (start_pos > i_size_read(inode)) {
1785 /* Expand hole size to cover write data, preventing empty gap */ 1785 /* Expand hole size to cover write data, preventing empty gap */
1786 end_pos = round_up(pos + iov->iov_len, root->sectorsize); 1786 end_pos = round_up(pos + count, root->sectorsize);
1787 err = btrfs_cont_expand(inode, i_size_read(inode), end_pos); 1787 err = btrfs_cont_expand(inode, i_size_read(inode), end_pos);
1788 if (err) { 1788 if (err) {
1789 mutex_unlock(&inode->i_mutex); 1789 mutex_unlock(&inode->i_mutex);