diff options
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b330e27c2d8b..8cd109972fa6 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -483,7 +483,8 @@ again: | |||
483 | nr_pages_ret = 0; | 483 | nr_pages_ret = 0; |
484 | 484 | ||
485 | /* flag the file so we don't compress in the future */ | 485 | /* flag the file so we don't compress in the future */ |
486 | BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS; | 486 | if (!btrfs_test_opt(root, FORCE_COMPRESS)) |
487 | BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS; | ||
487 | } | 488 | } |
488 | if (will_compress) { | 489 | if (will_compress) { |
489 | *num_added += 1; | 490 | *num_added += 1; |
@@ -3796,12 +3797,6 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
3796 | 3797 | ||
3797 | if (location.type == BTRFS_INODE_ITEM_KEY) { | 3798 | if (location.type == BTRFS_INODE_ITEM_KEY) { |
3798 | inode = btrfs_iget(dir->i_sb, &location, root); | 3799 | inode = btrfs_iget(dir->i_sb, &location, root); |
3799 | if (unlikely(root->clean_orphans) && | ||
3800 | !(inode->i_sb->s_flags & MS_RDONLY)) { | ||
3801 | down_read(&root->fs_info->cleanup_work_sem); | ||
3802 | btrfs_orphan_cleanup(root); | ||
3803 | up_read(&root->fs_info->cleanup_work_sem); | ||
3804 | } | ||
3805 | return inode; | 3800 | return inode; |
3806 | } | 3801 | } |
3807 | 3802 | ||
@@ -5799,7 +5794,7 @@ out_fail: | |||
5799 | } | 5794 | } |
5800 | 5795 | ||
5801 | static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | 5796 | static int prealloc_file_range(struct inode *inode, u64 start, u64 end, |
5802 | u64 alloc_hint, int mode) | 5797 | u64 alloc_hint, int mode, loff_t actual_len) |
5803 | { | 5798 | { |
5804 | struct btrfs_trans_handle *trans; | 5799 | struct btrfs_trans_handle *trans; |
5805 | struct btrfs_root *root = BTRFS_I(inode)->root; | 5800 | struct btrfs_root *root = BTRFS_I(inode)->root; |
@@ -5808,6 +5803,7 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | |||
5808 | u64 cur_offset = start; | 5803 | u64 cur_offset = start; |
5809 | u64 num_bytes = end - start; | 5804 | u64 num_bytes = end - start; |
5810 | int ret = 0; | 5805 | int ret = 0; |
5806 | u64 i_size; | ||
5811 | 5807 | ||
5812 | while (num_bytes > 0) { | 5808 | while (num_bytes > 0) { |
5813 | alloc_size = min(num_bytes, root->fs_info->max_extent); | 5809 | alloc_size = min(num_bytes, root->fs_info->max_extent); |
@@ -5846,8 +5842,12 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | |||
5846 | BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; | 5842 | BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; |
5847 | if (!(mode & FALLOC_FL_KEEP_SIZE) && | 5843 | if (!(mode & FALLOC_FL_KEEP_SIZE) && |
5848 | cur_offset > inode->i_size) { | 5844 | cur_offset > inode->i_size) { |
5849 | i_size_write(inode, cur_offset); | 5845 | if (cur_offset > actual_len) |
5850 | btrfs_ordered_update_i_size(inode, cur_offset, NULL); | 5846 | i_size = actual_len; |
5847 | else | ||
5848 | i_size = cur_offset; | ||
5849 | i_size_write(inode, i_size); | ||
5850 | btrfs_ordered_update_i_size(inode, i_size, NULL); | ||
5851 | } | 5851 | } |
5852 | 5852 | ||
5853 | ret = btrfs_update_inode(trans, root, inode); | 5853 | ret = btrfs_update_inode(trans, root, inode); |
@@ -5940,7 +5940,7 @@ static long btrfs_fallocate(struct inode *inode, int mode, | |||
5940 | !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { | 5940 | !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { |
5941 | ret = prealloc_file_range(inode, | 5941 | ret = prealloc_file_range(inode, |
5942 | cur_offset, last_byte, | 5942 | cur_offset, last_byte, |
5943 | alloc_hint, mode); | 5943 | alloc_hint, mode, offset+len); |
5944 | if (ret < 0) { | 5944 | if (ret < 0) { |
5945 | free_extent_map(em); | 5945 | free_extent_map(em); |
5946 | break; | 5946 | break; |