aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-07-11 10:47:06 -0400
committerChris Mason <chris.mason@oracle.com>2011-07-27 12:46:43 -0400
commita94733d0bc630edaedc6ca156752dd5a7cb82521 (patch)
tree3f0bd508aa1ce5894e43df45bb73031a380ed8f5 /fs
parentbab39bf998133510f2dad08158006197ec0dabea (diff)
Btrfs: use find_or_create_page instead of grab_cache_page
grab_cache_page will use mapping_gfp_mask(), which for all inodes is set to GFP_HIGHUSER_MOVABLE. So instead use find_or_create_page in all cases where we need GFP_NOFS so we don't deadlock. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/file.c3
-rw-r--r--fs/btrfs/free-space-cache.c4
-rw-r--r--fs/btrfs/inode.c2
-rw-r--r--fs/btrfs/ioctl.c4
-rw-r--r--fs/btrfs/relocation.c3
5 files changed, 9 insertions, 7 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index fa4ef18b66b..bd6bbb877ff 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1081,7 +1081,8 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
1081 1081
1082again: 1082again:
1083 for (i = 0; i < num_pages; i++) { 1083 for (i = 0; i < num_pages; i++) {
1084 pages[i] = grab_cache_page(inode->i_mapping, index + i); 1084 pages[i] = find_or_create_page(inode->i_mapping, index + i,
1085 GFP_NOFS);
1085 if (!pages[i]) { 1086 if (!pages[i]) {
1086 faili = i - 1; 1087 faili = i - 1;
1087 err = -ENOMEM; 1088 err = -ENOMEM;
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index fd7fa2a74f0..6377713f639 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -307,7 +307,7 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
307 if (!num_entries && !num_bitmaps) 307 if (!num_entries && !num_bitmaps)
308 break; 308 break;
309 309
310 page = grab_cache_page(inode->i_mapping, index); 310 page = find_or_create_page(inode->i_mapping, index, GFP_NOFS);
311 if (!page) 311 if (!page)
312 goto free_cache; 312 goto free_cache;
313 313
@@ -594,7 +594,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
594 * know and don't freak out. 594 * know and don't freak out.
595 */ 595 */
596 while (index < num_pages) { 596 while (index < num_pages) {
597 page = grab_cache_page(inode->i_mapping, index); 597 page = find_or_create_page(inode->i_mapping, index, GFP_NOFS);
598 if (!page) { 598 if (!page) {
599 int i; 599 int i;
600 600
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 4a137308374..2bf4d2b97d5 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3398,7 +3398,7 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from)
3398 3398
3399 ret = -ENOMEM; 3399 ret = -ENOMEM;
3400again: 3400again:
3401 page = grab_cache_page(mapping, index); 3401 page = find_or_create_page(mapping, index, GFP_NOFS);
3402 if (!page) { 3402 if (!page) {
3403 btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE); 3403 btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE);
3404 goto out; 3404 goto out;
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index a3c4751e07d..09c9a8d26ee 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -867,8 +867,8 @@ again:
867 /* step one, lock all the pages */ 867 /* step one, lock all the pages */
868 for (i = 0; i < num_pages; i++) { 868 for (i = 0; i < num_pages; i++) {
869 struct page *page; 869 struct page *page;
870 page = grab_cache_page(inode->i_mapping, 870 page = find_or_create_page(inode->i_mapping,
871 start_index + i); 871 start_index + i, GFP_NOFS);
872 if (!page) 872 if (!page)
873 break; 873 break;
874 874
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 086b1e6b861..41d76c60876 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2955,7 +2955,8 @@ static int relocate_file_extent_cluster(struct inode *inode,
2955 page_cache_sync_readahead(inode->i_mapping, 2955 page_cache_sync_readahead(inode->i_mapping,
2956 ra, NULL, index, 2956 ra, NULL, index,
2957 last_index + 1 - index); 2957 last_index + 1 - index);
2958 page = grab_cache_page(inode->i_mapping, index); 2958 page = find_or_create_page(inode->i_mapping, index,
2959 GFP_NOFS);
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);