diff options
author | Josef Bacik <josef@redhat.com> | 2011-09-21 15:05:58 -0400 |
---|---|---|
committer | Josef Bacik <josef@redhat.com> | 2011-10-19 15:12:45 -0400 |
commit | 3b16a4e3c355ee3c790473decfcf83d4faeb8ce0 (patch) | |
tree | 5c3dad941468cf6952623cc18d6b1e682ee3f264 /fs/btrfs/inode.c | |
parent | 455757c322cc0a0f2a692c5625dd88aaf6a7b889 (diff) |
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>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; |
3296 | again: | 3297 | again: |
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; |