@@ -8191,9 +8191,13 @@ static void btrfs_endio_direct_write(struct bio *bio)
{
struct btrfs_dio_private *dip = bio->bi_private;
struct bio *dio_bio = dip->dio_bio;
+ struct inode *inode = dip->inode;
- btrfs_update_ordered_extent(dip->inode, dip->logical_offset,
+ btrfs_update_ordered_extent(inode, dip->logical_offset,
dip->bytes, !bio->bi_status);
+ if (!bio->bi_status &&
+ i_size_read(inode) < dip->logical_offset + dip->bytes)
+ i_size_write(inode, dip->logical_offset + dip->bytes);
kfree(dip);