aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/ctree.h6
-rw-r--r--fs/btrfs/file.c3
-rw-r--r--fs/btrfs/free-space-cache.c6
-rw-r--r--fs/btrfs/inode.c3
-rw-r--r--fs/btrfs/ioctl.c3
-rw-r--r--fs/btrfs/relocation.c3
6 files changed, 18 insertions, 6 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index a5faf8e33baa..47dea7118e0e 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -30,6 +30,7 @@
30#include <linux/kobject.h> 30#include <linux/kobject.h>
31#include <trace/events/btrfs.h> 31#include <trace/events/btrfs.h>
32#include <asm/kmap_types.h> 32#include <asm/kmap_types.h>
33#include <linux/pagemap.h>
33#include "extent_io.h" 34#include "extent_io.h"
34#include "extent_map.h" 35#include "extent_map.h"
35#include "async-thread.h" 36#include "async-thread.h"
@@ -2117,6 +2118,11 @@ static inline bool btrfs_mixed_space_info(struct btrfs_space_info *space_info)
2117 (space_info->flags & BTRFS_BLOCK_GROUP_DATA)); 2118 (space_info->flags & BTRFS_BLOCK_GROUP_DATA));
2118} 2119}
2119 2120
2121static inline gfp_t btrfs_alloc_write_mask(struct address_space *mapping)
2122{
2123 return mapping_gfp_mask(mapping) & ~__GFP_FS;
2124}
2125
2120/* extent-tree.c */ 2126/* extent-tree.c */
2121static inline u64 btrfs_calc_trans_metadata_size(struct btrfs_root *root, 2127static inline u64 btrfs_calc_trans_metadata_size(struct btrfs_root *root,
2122 unsigned num_items) 2128 unsigned num_items)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index de569af766fe..f2e928289600 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1069,6 +1069,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
1069 int i; 1069 int i;
1070 unsigned long index = pos >> PAGE_CACHE_SHIFT; 1070 unsigned long index = pos >> PAGE_CACHE_SHIFT;
1071 struct inode *inode = fdentry(file)->d_inode; 1071 struct inode *inode = fdentry(file)->d_inode;
1072 gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping);
1072 int err = 0; 1073 int err = 0;
1073 int faili = 0; 1074 int faili = 0;
1074 u64 start_pos; 1075 u64 start_pos;
@@ -1080,7 +1081,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
1080again: 1081again:
1081 for (i = 0; i < num_pages; i++) { 1082 for (i = 0; i < num_pages; i++) {
1082 pages[i] = find_or_create_page(inode->i_mapping, index + i, 1083 pages[i] = find_or_create_page(inode->i_mapping, index + i,
1083 GFP_NOFS); 1084 mask);
1084 if (!pages[i]) { 1085 if (!pages[i]) {
1085 faili = i - 1; 1086 faili = i - 1;
1086 err = -ENOMEM; 1087 err = -ENOMEM;
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index ffc42ef44711..0a8ccdbdd464 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -254,6 +254,7 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
254 u64 num_bitmaps; 254 u64 num_bitmaps;
255 u64 generation; 255 u64 generation;
256 pgoff_t index = 0; 256 pgoff_t index = 0;
257 gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping);
257 int ret = 0; 258 int ret = 0;
258 259
259 INIT_LIST_HEAD(&bitmaps); 260 INIT_LIST_HEAD(&bitmaps);
@@ -310,7 +311,7 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
310 if (!num_entries && !num_bitmaps) 311 if (!num_entries && !num_bitmaps)
311 break; 312 break;
312 313
313 page = find_or_create_page(inode->i_mapping, index, GFP_NOFS); 314 page = find_or_create_page(inode->i_mapping, index, mask);
314 if (!page) 315 if (!page)
315 goto free_cache; 316 goto free_cache;
316 317
@@ -563,6 +564,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
563 u64 start, end, len; 564 u64 start, end, len;
564 u64 bytes = 0; 565 u64 bytes = 0;
565 u32 crc = ~(u32)0; 566 u32 crc = ~(u32)0;
567 gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping);
566 int index = 0, num_pages = 0; 568 int index = 0, num_pages = 0;
567 int entries = 0; 569 int entries = 0;
568 int bitmaps = 0; 570 int bitmaps = 0;
@@ -612,7 +614,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
612 * know and don't freak out. 614 * know and don't freak out.
613 */ 615 */
614 while (index < num_pages) { 616 while (index < num_pages) {
615 page = find_or_create_page(inode->i_mapping, index, GFP_NOFS); 617 page = find_or_create_page(inode->i_mapping, index, mask);
616 if (!page) { 618 if (!page) {
617 int i; 619 int i;
618 620
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2947e94947b5..88e3956be57d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3282,6 +3282,7 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from)
3282 pgoff_t index = from >> PAGE_CACHE_SHIFT; 3282 pgoff_t index = from >> PAGE_CACHE_SHIFT;
3283 unsigned offset = from & (PAGE_CACHE_SIZE-1); 3283 unsigned offset = from & (PAGE_CACHE_SIZE-1);
3284 struct page *page; 3284 struct page *page;
3285 gfp_t mask = btrfs_alloc_write_mask(mapping);
3285 int ret = 0; 3286 int ret = 0;
3286 u64 page_start; 3287 u64 page_start;
3287 u64 page_end; 3288 u64 page_end;
@@ -3294,7 +3295,7 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from)
3294 3295
3295 ret = -ENOMEM; 3296 ret = -ENOMEM;
3296again: 3297again:
3297 page = find_or_create_page(mapping, index, GFP_NOFS); 3298 page = find_or_create_page(mapping, index, mask);
3298 if (!page) { 3299 if (!page) {
3299 btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE); 3300 btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE);
3300 goto out; 3301 goto out;
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 538f65a79ec5..24fd75bb0f96 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -843,6 +843,7 @@ static int cluster_pages_for_defrag(struct inode *inode,
843 int i_done; 843 int i_done;
844 struct btrfs_ordered_extent *ordered; 844 struct btrfs_ordered_extent *ordered;
845 struct extent_state *cached_state = NULL; 845 struct extent_state *cached_state = NULL;
846 gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping);
846 847
847 if (isize == 0) 848 if (isize == 0)
848 return 0; 849 return 0;
@@ -860,7 +861,7 @@ again:
860 for (i = 0; i < num_pages; i++) { 861 for (i = 0; i < num_pages; i++) {
861 struct page *page; 862 struct page *page;
862 page = find_or_create_page(inode->i_mapping, 863 page = find_or_create_page(inode->i_mapping,
863 start_index + i, GFP_NOFS); 864 start_index + i, mask);
864 if (!page) 865 if (!page)
865 break; 866 break;
866 867
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 3ab67409f90f..7fa090fa0d39 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2921,6 +2921,7 @@ static int relocate_file_extent_cluster(struct inode *inode,
2921 unsigned long last_index; 2921 unsigned long last_index;
2922 struct page *page; 2922 struct page *page;
2923 struct file_ra_state *ra; 2923 struct file_ra_state *ra;
2924 gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping);
2924 int nr = 0; 2925 int nr = 0;
2925 int ret = 0; 2926 int ret = 0;
2926 2927
@@ -2955,7 +2956,7 @@ static int relocate_file_extent_cluster(struct inode *inode,
2955 ra, NULL, index, 2956 ra, NULL, index,
2956 last_index + 1 - index); 2957 last_index + 1 - index);
2957 page = find_or_create_page(inode->i_mapping, index, 2958 page = find_or_create_page(inode->i_mapping, index,
2958 GFP_NOFS); 2959 mask);
2959 if (!page) { 2960 if (!page) {
2960 btrfs_delalloc_release_metadata(inode, 2961 btrfs_delalloc_release_metadata(inode,
2961 PAGE_CACHE_SIZE); 2962 PAGE_CACHE_SIZE);