diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c0dcb4c3d72dab3c3d6b93c2f8e20a2cee06b1db..1ca49eaba3bb4aee7e18aba92e38bbc500e71e69 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4239,15 +4239,16 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) while (1) { struct btrfs_ordered_extent *ordered; - btrfs_wait_ordered_range(inode, hole_start, - block_end - hole_start); + lock_extent_bits(io_tree, hole_start, block_end - 1, 0, &cached_state); - ordered = btrfs_lookup_ordered_extent(inode, hole_start); + ordered = btrfs_lookup_ordered_range(inode, hole_start, + block_end - hole_start); if (!ordered) break; unlock_extent_cached(io_tree, hole_start, block_end - 1, &cached_state, GFP_NOFS); + btrfs_start_ordered_extent(inode, ordered, 1); btrfs_put_ordered_extent(ordered); }