Merge branch 'misc-4.6' into for-chris-4.6
authorDavid Sterba <dsterba@suse.com>
Fri, 26 Feb 2016 14:38:34 +0000 (15:38 +0100)
committerDavid Sterba <dsterba@suse.com>
Fri, 26 Feb 2016 14:38:34 +0000 (15:38 +0100)
# Conflicts:
# fs/btrfs/file.c

1  2 
fs/btrfs/ctree.h
fs/btrfs/file.c
fs/btrfs/ioctl.c

index 67fca268449b16ced382f9da33e9357a5eb998c4,6661ad8b4088d5eba027a7b6bd72f482977dcfd2..c3e634924149e5ed89d0c2418df970830f626204
@@@ -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 4ab4b5cdf4b0031014a4c1551fd297494e72eca8,cadfebaaf8c4ed16c0fca0b8b65bd0933cadde0c..03de2466db234ecd7360cb59ba4c5f8b54c69871
@@@ -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;
Simple merge