aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 00aefbdcc2df..ca9d5501d340 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5602,9 +5602,16 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
5602 ssize_t ret; 5602 ssize_t ret;
5603 int writing = rw & WRITE; 5603 int writing = rw & WRITE;
5604 int write_bits = 0; 5604 int write_bits = 0;
5605 size_t count = iov_length(iov, nr_segs);
5605 5606
5606 lockstart = offset; 5607 lockstart = offset;
5607 lockend = offset + iov_length(iov, nr_segs) - 1; 5608 lockend = offset + count - 1;
5609
5610 if (writing) {
5611 ret = btrfs_delalloc_reserve_space(inode, count);
5612 if (ret)
5613 goto out;
5614 }
5608 5615
5609 while (1) { 5616 while (1) {
5610 lock_extent_bits(&BTRFS_I(inode)->io_tree, lockstart, lockend, 5617 lock_extent_bits(&BTRFS_I(inode)->io_tree, lockstart, lockend,