Merge branch 'allocator-fixes' into for-linus-4.4
authorChris Mason <clm@fb.com>
Thu, 22 Oct 2015 02:00:38 +0000 (19:00 -0700)
committerChris Mason <clm@fb.com>
Thu, 22 Oct 2015 02:00:38 +0000 (19:00 -0700)
Signed-off-by: Chris Mason <clm@fb.com>
1  2 
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/inode.c
fs/btrfs/transaction.c
fs/btrfs/transaction.h

Simple merge
Simple merge
index 46609607789b36fcf50218f7234ab5bd20dd0a07,475764502d42019edf3a152c45b3700169af3d09..92fdbc6b89e76e63725da41a4985713320136c80
@@@ -3363,9 -3431,19 +3436,19 @@@ again
        ret = btrfs_prealloc_file_range_trans(inode, trans, 0, 0, num_pages,
                                              num_pages, num_pages,
                                              &alloc_hint);
+       /*
+        * Our cache requires contiguous chunks so that we don't modify a bunch
+        * of metadata or split extents when writing the cache out, which means
+        * we can enospc if we are heavily fragmented in addition to just normal
+        * out of space conditions.  So if we hit this just skip setting up any
+        * other block groups for this transaction, maybe we'll unpin enough
+        * space the next time around.
+        */
        if (!ret)
                dcs = BTRFS_DC_SETUP;
 -      btrfs_free_reserved_data_space(inode, num_pages);
+       else if (ret == -ENOSPC)
+               set_bit(BTRFS_TRANS_CACHE_ENOSPC, &trans->transaction->flags);
 +      btrfs_free_reserved_data_space(inode, 0, num_pages);
  
  out_put:
        iput(inode);
Simple merge
Simple merge
Simple merge