Merge branch 'misc-4.6' into for-chris-4.6

# Conflicts:
#	fs/btrfs/file.c
This commit is contained in:
David Sterba 2016-02-26 15:38:34 +01:00
commit fa695b01bc
5 changed files with 20 additions and 31 deletions

View file

@ -2291,7 +2291,7 @@ struct btrfs_ioctl_defrag_range_args {
#define BTRFS_MOUNT_NOLOGREPLAY (1 << 27) #define BTRFS_MOUNT_NOLOGREPLAY (1 << 27)
#define BTRFS_DEFAULT_COMMIT_INTERVAL (30) #define BTRFS_DEFAULT_COMMIT_INTERVAL (30)
#define BTRFS_DEFAULT_MAX_INLINE (8192) #define BTRFS_DEFAULT_MAX_INLINE (2048)
#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt)
#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)

View file

@ -1533,29 +1533,25 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
reserve_bytes = round_up(write_bytes + sector_offset, reserve_bytes = round_up(write_bytes + sector_offset,
root->sectorsize); root->sectorsize);
if (BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW | if ((BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW |
BTRFS_INODE_PREALLOC)) { BTRFS_INODE_PREALLOC)) &&
ret = check_can_nocow(inode, pos, &write_bytes); check_can_nocow(inode, pos, &write_bytes) > 0) {
if (ret < 0) /*
break; * For nodata cow case, no need to reserve
if (ret > 0) { * data space.
/* */
* For nodata cow case, no need to reserve only_release_metadata = true;
* data space. /*
*/ * our prealloc extent may be smaller than
only_release_metadata = true; * write_bytes, so scale down.
/* */
* our prealloc extent may be smaller than num_pages = DIV_ROUND_UP(write_bytes + offset,
* write_bytes, so scale down. PAGE_CACHE_SIZE);
*/ reserve_bytes = round_up(write_bytes + sector_offset,
num_pages = DIV_ROUND_UP(write_bytes + offset, root->sectorsize);
PAGE_CACHE_SIZE); goto reserve_metadata;
reserve_bytes = round_up(write_bytes
+ sector_offset,
root->sectorsize);
goto reserve_metadata;
}
} }
ret = btrfs_check_data_free_space(inode, pos, write_bytes); ret = btrfs_check_data_free_space(inode, pos, write_bytes);
if (ret < 0) if (ret < 0)
break; break;

View file

@ -2093,8 +2093,6 @@ static noinline int search_ioctl(struct inode *inode,
key.offset = (u64)-1; key.offset = (u64)-1;
root = btrfs_read_fs_root_no_name(info, &key); root = btrfs_read_fs_root_no_name(info, &key);
if (IS_ERR(root)) { if (IS_ERR(root)) {
btrfs_err(info, "could not find root %llu",
sk->tree_id);
btrfs_free_path(path); btrfs_free_path(path);
return -ENOENT; return -ENOENT;
} }

View file

@ -189,12 +189,6 @@ btrfs_alloc_dummy_block_group(unsigned long length)
kfree(cache); kfree(cache);
return NULL; return NULL;
} }
cache->fs_info = btrfs_alloc_dummy_fs_info();
if (!cache->fs_info) {
kfree(cache->free_space_ctl);
kfree(cache);
return NULL;
}
cache->key.objectid = 0; cache->key.objectid = 0;
cache->key.offset = length; cache->key.offset = length;

View file

@ -485,6 +485,7 @@ static int run_test(test_func_t test_func, int bitmaps)
cache->bitmap_low_thresh = 0; cache->bitmap_low_thresh = 0;
cache->bitmap_high_thresh = (u32)-1; cache->bitmap_high_thresh = (u32)-1;
cache->needs_free_space = 1; cache->needs_free_space = 1;
cache->fs_info = root->fs_info;
btrfs_init_dummy_trans(&trans); btrfs_init_dummy_trans(&trans);