Commit 0faa70cb authored by Johannes Weiner's avatar Johannes Weiner Committed by Linus Torvalds

mm: filemap: pass __GFP_WRITE from grab_cache_page_write_begin()

Tell the page allocator that pages allocated through
grab_cache_page_write_begin() are expected to become dirty soon.
Signed-off-by: default avatarJohannes Weiner <jweiner@redhat.com>
Reviewed-by: default avatarRik van Riel <riel@redhat.com>
Acked-by: default avatarMel Gorman <mgorman@suse.de>
Reviewed-by: default avatarMinchan Kim <minchan.kim@gmail.com>
Reviewed-by: default avatarMichal Hocko <mhocko@suse.cz>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Shaohua Li <shaohua.li@intel.com>
Cc: Chris Mason <chris.mason@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a756cf59
...@@ -2351,8 +2351,11 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping, ...@@ -2351,8 +2351,11 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping,
pgoff_t index, unsigned flags) pgoff_t index, unsigned flags)
{ {
int status; int status;
gfp_t gfp_mask;
struct page *page; struct page *page;
gfp_t gfp_notmask = 0; gfp_t gfp_notmask = 0;
gfp_mask = mapping_gfp_mask(mapping) | __GFP_WRITE;
if (flags & AOP_FLAG_NOFS) if (flags & AOP_FLAG_NOFS)
gfp_notmask = __GFP_FS; gfp_notmask = __GFP_FS;
repeat: repeat:
...@@ -2360,7 +2363,7 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping, ...@@ -2360,7 +2363,7 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping,
if (page) if (page)
goto found; goto found;
page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask); page = __page_cache_alloc(gfp_mask & ~gfp_notmask);
if (!page) if (!page)
return NULL; return NULL;
status = add_to_page_cache_lru(page, mapping, index, status = add_to_page_cache_lru(page, mapping, index,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment