aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cachefiles/rdwr.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-12-20 16:52:33 -0500
committerDavid Howells <dhowells@redhat.com>2012-12-20 16:58:25 -0500
commit5f4f9f4af185d5e76c966d2d3420a61870c856e7 (patch)
treeb2f41124474891a58ec77cbbdb6adccb704073d6 /fs/cachefiles/rdwr.c
parentc4d6d8dbf335c7fa47341654a37c53a512b519bb (diff)
CacheFiles: Downgrade the requirements passed to the allocator
Downgrade the requirements passed to the allocator in the gfp flags parameter. FS-Cache/CacheFiles can handle OOM conditions simply by aborting the attempt to store an object or a page in the cache. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/cachefiles/rdwr.c')
-rw-r--r--fs/cachefiles/rdwr.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index 3367abdcdac..9108b8ea505 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -238,7 +238,7 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object,
238 _debug("read back %p{%lu,%d}", 238 _debug("read back %p{%lu,%d}",
239 netpage, netpage->index, page_count(netpage)); 239 netpage, netpage->index, page_count(netpage));
240 240
241 monitor = kzalloc(sizeof(*monitor), GFP_KERNEL); 241 monitor = kzalloc(sizeof(*monitor), cachefiles_gfp);
242 if (!monitor) 242 if (!monitor)
243 goto nomem; 243 goto nomem;
244 244
@@ -257,13 +257,14 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object,
257 goto backing_page_already_present; 257 goto backing_page_already_present;
258 258
259 if (!newpage) { 259 if (!newpage) {
260 newpage = page_cache_alloc_cold(bmapping); 260 newpage = __page_cache_alloc(cachefiles_gfp |
261 __GFP_COLD);
261 if (!newpage) 262 if (!newpage)
262 goto nomem_monitor; 263 goto nomem_monitor;
263 } 264 }
264 265
265 ret = add_to_page_cache(newpage, bmapping, 266 ret = add_to_page_cache(newpage, bmapping,
266 netpage->index, GFP_KERNEL); 267 netpage->index, cachefiles_gfp);
267 if (ret == 0) 268 if (ret == 0)
268 goto installed_new_backing_page; 269 goto installed_new_backing_page;
269 if (ret != -EEXIST) 270 if (ret != -EEXIST)
@@ -481,7 +482,7 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
481 netpage, netpage->index, page_count(netpage)); 482 netpage, netpage->index, page_count(netpage));
482 483
483 if (!monitor) { 484 if (!monitor) {
484 monitor = kzalloc(sizeof(*monitor), GFP_KERNEL); 485 monitor = kzalloc(sizeof(*monitor), cachefiles_gfp);
485 if (!monitor) 486 if (!monitor)
486 goto nomem; 487 goto nomem;
487 488
@@ -496,13 +497,14 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
496 goto backing_page_already_present; 497 goto backing_page_already_present;
497 498
498 if (!newpage) { 499 if (!newpage) {
499 newpage = page_cache_alloc_cold(bmapping); 500 newpage = __page_cache_alloc(cachefiles_gfp |
501 __GFP_COLD);
500 if (!newpage) 502 if (!newpage)
501 goto nomem; 503 goto nomem;
502 } 504 }
503 505
504 ret = add_to_page_cache(newpage, bmapping, 506 ret = add_to_page_cache(newpage, bmapping,
505 netpage->index, GFP_KERNEL); 507 netpage->index, cachefiles_gfp);
506 if (ret == 0) 508 if (ret == 0)
507 goto installed_new_backing_page; 509 goto installed_new_backing_page;
508 if (ret != -EEXIST) 510 if (ret != -EEXIST)
@@ -532,7 +534,7 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
532 _debug("- monitor add"); 534 _debug("- monitor add");
533 535
534 ret = add_to_page_cache(netpage, op->mapping, netpage->index, 536 ret = add_to_page_cache(netpage, op->mapping, netpage->index,
535 GFP_KERNEL); 537 cachefiles_gfp);
536 if (ret < 0) { 538 if (ret < 0) {
537 if (ret == -EEXIST) { 539 if (ret == -EEXIST) {
538 page_cache_release(netpage); 540 page_cache_release(netpage);
@@ -608,7 +610,7 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
608 _debug("- uptodate"); 610 _debug("- uptodate");
609 611
610 ret = add_to_page_cache(netpage, op->mapping, netpage->index, 612 ret = add_to_page_cache(netpage, op->mapping, netpage->index,
611 GFP_KERNEL); 613 cachefiles_gfp);
612 if (ret < 0) { 614 if (ret < 0) {
613 if (ret == -EEXIST) { 615 if (ret == -EEXIST) {
614 page_cache_release(netpage); 616 page_cache_release(netpage);