shmem.c (8e205f779d1443a94b5ae81aa359cb535dd3021e) | shmem.c (b1a366500bd537b50c3aad26dc7df083ec03a448) |
---|---|
1/* 2 * Resizable virtual memory filesystem for Linux. 3 * 4 * Copyright (C) 2000 Linus Torvalds. 5 * 2000 Transmeta Corp. 6 * 2000-2001 Christoph Rohland 7 * 2000-2001 SAP AG 8 * 2002 Red Hat Inc. --- 454 unchanged lines hidden (view full) --- 463 unlock_page(page); 464 page_cache_release(page); 465 } 466 } 467 if (start >= end) 468 return; 469 470 index = start; | 1/* 2 * Resizable virtual memory filesystem for Linux. 3 * 4 * Copyright (C) 2000 Linus Torvalds. 5 * 2000 Transmeta Corp. 6 * 2000-2001 Christoph Rohland 7 * 2000-2001 SAP AG 8 * 2002 Red Hat Inc. --- 454 unchanged lines hidden (view full) --- 463 unlock_page(page); 464 page_cache_release(page); 465 } 466 } 467 if (start >= end) 468 return; 469 470 index = start; |
471 for ( ; ; ) { | 471 while (index < end) { |
472 cond_resched(); 473 474 pvec.nr = find_get_entries(mapping, index, 475 min(end - index, (pgoff_t)PAGEVEC_SIZE), 476 pvec.pages, indices); 477 if (!pvec.nr) { | 472 cond_resched(); 473 474 pvec.nr = find_get_entries(mapping, index, 475 min(end - index, (pgoff_t)PAGEVEC_SIZE), 476 pvec.pages, indices); 477 if (!pvec.nr) { |
478 if (index == start || unfalloc) | 478 /* If all gone or hole-punch or unfalloc, we're done */ 479 if (index == start || end != -1) |
479 break; | 480 break; |
481 /* But if truncating, restart to make sure all gone */ |
|
480 index = start; 481 continue; 482 } | 482 index = start; 483 continue; 484 } |
483 if ((index == start || unfalloc) && indices[0] >= end) { 484 pagevec_remove_exceptionals(&pvec); 485 pagevec_release(&pvec); 486 break; 487 } | |
488 mem_cgroup_uncharge_start(); 489 for (i = 0; i < pagevec_count(&pvec); i++) { 490 struct page *page = pvec.pages[i]; 491 492 index = indices[i]; 493 if (index >= end) 494 break; 495 496 if (radix_tree_exceptional_entry(page)) { 497 if (unfalloc) 498 continue; | 485 mem_cgroup_uncharge_start(); 486 for (i = 0; i < pagevec_count(&pvec); i++) { 487 struct page *page = pvec.pages[i]; 488 489 index = indices[i]; 490 if (index >= end) 491 break; 492 493 if (radix_tree_exceptional_entry(page)) { 494 if (unfalloc) 495 continue; |
499 nr_swaps_freed += !shmem_free_swap(mapping, 500 index, page); | 496 if (shmem_free_swap(mapping, index, page)) { 497 /* Swap was replaced by page: retry */ 498 index--; 499 break; 500 } 501 nr_swaps_freed++; |
501 continue; 502 } 503 504 lock_page(page); 505 if (!unfalloc || !PageUptodate(page)) { 506 if (page->mapping == mapping) { 507 VM_BUG_ON_PAGE(PageWriteback(page), page); 508 truncate_inode_page(mapping, page); | 502 continue; 503 } 504 505 lock_page(page); 506 if (!unfalloc || !PageUptodate(page)) { 507 if (page->mapping == mapping) { 508 VM_BUG_ON_PAGE(PageWriteback(page), page); 509 truncate_inode_page(mapping, page); |
510 } else { 511 /* Page was replaced by swap: retry */ 512 unlock_page(page); 513 index--; 514 break; |
|
509 } 510 } 511 unlock_page(page); 512 } 513 pagevec_remove_exceptionals(&pvec); 514 pagevec_release(&pvec); 515 mem_cgroup_uncharge_end(); 516 index++; --- 2530 unchanged lines hidden --- | 515 } 516 } 517 unlock_page(page); 518 } 519 pagevec_remove_exceptionals(&pvec); 520 pagevec_release(&pvec); 521 mem_cgroup_uncharge_end(); 522 index++; --- 2530 unchanged lines hidden --- |