mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
Merge branch 'misc-4.6' into for-chris-4.6
# Conflicts: # fs/btrfs/file.c
This commit is contained in:
commit
fa695b01bc
5 changed files with 20 additions and 31 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue