All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: Change the hole range to a more accurate value.
@ 2014-04-15  2:41 Qu Wenruo
  0 siblings, 0 replies; only message in thread
From: Qu Wenruo @ 2014-04-15  2:41 UTC (permalink / raw)
  To: linux-btrfs

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>
---
 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 eb742c0..a4ce634 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1777,7 +1777,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
 	start_pos = round_down(pos, root->sectorsize);
 	if (start_pos > i_size_read(inode)) {
 		/* Expand hole size to cover write data, preventing empty gap */
-		end_pos = round_up(pos + iov->iov_len, root->sectorsize);
+		end_pos = round_up(pos + count, root->sectorsize);
 		err = btrfs_cont_expand(inode, i_size_read(inode), end_pos);
 		if (err) {
 			mutex_unlock(&inode->i_mutex);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-04-15  2:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15  2:41 [PATCH] btrfs: Change the hole range to a more accurate value Qu Wenruo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.