diff options
author | David Sterba <dsterba@suse.com> | 2016-02-26 15:38:34 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-02-26 15:38:34 +0100 |
commit | fa695b01bceabc40be3267d309ca8a663de53d7a (patch) | |
tree | 017a66e7b0c2d928d3edc9531cf04bd3debf346a /fs/btrfs/file.c | |
parent | f004fae0cfeb96d33240eb5471f14cb6fbbd4eea (diff) | |
parent | f7e98a7fff8634ae655c666dc2c9fc55a48d0a73 (diff) | |
download | op-kernel-dev-fa695b01bceabc40be3267d309ca8a663de53d7a.zip op-kernel-dev-fa695b01bceabc40be3267d309ca8a663de53d7a.tar.gz |
Merge branch 'misc-4.6' into for-chris-4.6
# Conflicts:
# fs/btrfs/file.c
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 4ab4b5c..03de246 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1533,29 +1533,25 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file, reserve_bytes = round_up(write_bytes + sector_offset, root->sectorsize); - if (BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW | - BTRFS_INODE_PREALLOC)) { - ret = check_can_nocow(inode, pos, &write_bytes); - if (ret < 0) - break; - if (ret > 0) { - /* - * For nodata cow case, no need to reserve - * data space. - */ - only_release_metadata = true; - /* - * our prealloc extent may be smaller than - * write_bytes, so scale down. - */ - num_pages = DIV_ROUND_UP(write_bytes + offset, - PAGE_CACHE_SIZE); - reserve_bytes = round_up(write_bytes - + sector_offset, - root->sectorsize); - goto reserve_metadata; - } + if ((BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW | + BTRFS_INODE_PREALLOC)) && + check_can_nocow(inode, pos, &write_bytes) > 0) { + /* + * For nodata cow case, no need to reserve + * data space. + */ + only_release_metadata = true; + /* + * our prealloc extent may be smaller than + * write_bytes, so scale down. + */ + num_pages = DIV_ROUND_UP(write_bytes + offset, + PAGE_CACHE_SIZE); + reserve_bytes = round_up(write_bytes + sector_offset, + root->sectorsize); + goto reserve_metadata; } + ret = btrfs_check_data_free_space(inode, pos, write_bytes); if (ret < 0) break; |