Btrfs: use the inode's mapping mask for allocating pages
Johannes pointed out we were allocating only kernel pages for doing writes,
which is kind of a big deal if you are on 32bit and have more than a gig of ram.
So fix our allocations to use the mapping's gfp but still clear __GFP_FS so we
don't re-enter. Thanks,
Reported-by: Johannes Weiner <jweiner@redhat.com>
Signed-off-by: Josef Bacik <josef@redhat.com>
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index ffc42ef..0a8ccdb 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -254,6 +254,7 @@
u64 num_bitmaps;
u64 generation;
pgoff_t index = 0;
+ gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping);
int ret = 0;
INIT_LIST_HEAD(&bitmaps);
@@ -310,7 +311,7 @@
if (!num_entries && !num_bitmaps)
break;
- page = find_or_create_page(inode->i_mapping, index, GFP_NOFS);
+ page = find_or_create_page(inode->i_mapping, index, mask);
if (!page)
goto free_cache;
@@ -563,6 +564,7 @@
u64 start, end, len;
u64 bytes = 0;
u32 crc = ~(u32)0;
+ gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping);
int index = 0, num_pages = 0;
int entries = 0;
int bitmaps = 0;
@@ -612,7 +614,7 @@
* know and don't freak out.
*/
while (index < num_pages) {
- page = find_or_create_page(inode->i_mapping, index, GFP_NOFS);
+ page = find_or_create_page(inode->i_mapping, index, mask);
if (!page) {
int i;