From: David Sterba Date: Fri, 26 Feb 2016 14:38:34 +0000 (+0100) Subject: Merge branch 'misc-4.6' into for-chris-4.6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fa695b01bceabc40be3267d309ca8a663de53d7a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Merge branch 'misc-4.6' into for-chris-4.6 # Conflicts: # fs/btrfs/file.c --- fa695b01bceabc40be3267d309ca8a663de53d7a diff --cc fs/btrfs/ctree.h index 67fca268449b,6661ad8b4088..c3e634924149 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@@ -2288,10 -2250,9 +2288,10 @@@ struct btrfs_ioctl_defrag_range_args #define BTRFS_MOUNT_FRAGMENT_DATA (1 << 24) #define BTRFS_MOUNT_FRAGMENT_METADATA (1 << 25) #define BTRFS_MOUNT_FREE_SPACE_TREE (1 << 26) +#define BTRFS_MOUNT_NOLOGREPLAY (1 << 27) #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_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) diff --cc fs/btrfs/file.c index 4ab4b5cdf4b0,cadfebaaf8c4..03de2466db23 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@@ -1529,33 -1523,26 +1529,29 @@@ static noinline ssize_t __btrfs_buffere break; } - reserve_bytes = num_pages << PAGE_CACHE_SHIFT; + sector_offset = pos & (root->sectorsize - 1); + 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 = num_pages << PAGE_CACHE_SHIFT; ++ 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;