Skip to content

Commit c5f7d0b

Browse files
Qu Wenruomasoncl
authored andcommitted
btrfs: Change the hole range to a more accurate value.
Commit 3ac0d7b 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 <[email protected]> Signed-off-by: Qu Wenruo <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent 0040e60 commit c5f7d0b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
17831783
start_pos = round_down(pos, root->sectorsize);
17841784
if (start_pos > i_size_read(inode)) {
17851785
/* 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);
17871787
err = btrfs_cont_expand(inode, i_size_read(inode), end_pos);
17881788
if (err) {
17891789
mutex_unlock(&inode->i_mutex);

0 commit comments

Comments
 (0)