summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-02-26 15:38:34 +0100
committerDavid Sterba <dsterba@suse.com>2016-02-26 15:38:34 +0100
commitfa695b01bceabc40be3267d309ca8a663de53d7a (patch)
tree017a66e7b0c2d928d3edc9531cf04bd3debf346a /fs/btrfs/file.c
parentf004fae0cfeb96d33240eb5471f14cb6fbbd4eea (diff)
parentf7e98a7fff8634ae655c666dc2c9fc55a48d0a73 (diff)
downloadop-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.c40
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;
OpenPOWER on IntegriCloud