aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-03-31 15:34:58 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-03-31 15:34:58 -0500
commit86579dd06deecfa6ac88d5e84e4d63c397cd6f6d (patch)
treeb4475d3ccde53015ad84a06e4e55e64591171b75 /mm/filemap.c
parent7ea9ea832212c4a755650f7c7cc1ff0b63292a41 (diff)
parenta0f067802576d4eb4c65d40b8ee7d6ea3c81dd61 (diff)
Merge branch 'master'
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c43
1 files changed, 37 insertions, 6 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 7624c26fcea6..1120338a5d0f 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -29,7 +29,10 @@
29#include <linux/blkdev.h> 29#include <linux/blkdev.h>
30#include <linux/security.h> 30#include <linux/security.h>
31#include <linux/syscalls.h> 31#include <linux/syscalls.h>
32#include <linux/cpuset.h>
32#include "filemap.h" 33#include "filemap.h"
34#include "internal.h"
35
33/* 36/*
34 * FIXME: remove all knowledge of the buffer layer from the core VM 37 * FIXME: remove all knowledge of the buffer layer from the core VM
35 */ 38 */
@@ -172,7 +175,7 @@ static int sync_page(void *word)
172 * dirty pages that lie within the byte offsets <start, end> 175 * dirty pages that lie within the byte offsets <start, end>
173 * @mapping: address space structure to write 176 * @mapping: address space structure to write
174 * @start: offset in bytes where the range starts 177 * @start: offset in bytes where the range starts
175 * @end: offset in bytes where the range ends 178 * @end: offset in bytes where the range ends (inclusive)
176 * @sync_mode: enable synchronous operation 179 * @sync_mode: enable synchronous operation
177 * 180 *
178 * If sync_mode is WB_SYNC_ALL then this is a "data integrity" operation, as 181 * If sync_mode is WB_SYNC_ALL then this is a "data integrity" operation, as
@@ -180,8 +183,8 @@ static int sync_page(void *word)
180 * these two operations is that if a dirty page/buffer is encountered, it must 183 * these two operations is that if a dirty page/buffer is encountered, it must
181 * be waited upon, and not just skipped over. 184 * be waited upon, and not just skipped over.
182 */ 185 */
183static int __filemap_fdatawrite_range(struct address_space *mapping, 186int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start,
184 loff_t start, loff_t end, int sync_mode) 187 loff_t end, int sync_mode)
185{ 188{
186 int ret; 189 int ret;
187 struct writeback_control wbc = { 190 struct writeback_control wbc = {
@@ -210,8 +213,8 @@ int filemap_fdatawrite(struct address_space *mapping)
210} 213}
211EXPORT_SYMBOL(filemap_fdatawrite); 214EXPORT_SYMBOL(filemap_fdatawrite);
212 215
213static int filemap_fdatawrite_range(struct address_space *mapping, 216static int filemap_fdatawrite_range(struct address_space *mapping, loff_t start,
214 loff_t start, loff_t end) 217 loff_t end)
215{ 218{
216 return __filemap_fdatawrite_range(mapping, start, end, WB_SYNC_ALL); 219 return __filemap_fdatawrite_range(mapping, start, end, WB_SYNC_ALL);
217} 220}
@@ -230,7 +233,7 @@ EXPORT_SYMBOL(filemap_flush);
230 * Wait for writeback to complete against pages indexed by start->end 233 * Wait for writeback to complete against pages indexed by start->end
231 * inclusive 234 * inclusive
232 */ 235 */
233static int wait_on_page_writeback_range(struct address_space *mapping, 236int wait_on_page_writeback_range(struct address_space *mapping,
234 pgoff_t start, pgoff_t end) 237 pgoff_t start, pgoff_t end)
235{ 238{
236 struct pagevec pvec; 239 struct pagevec pvec;
@@ -365,6 +368,12 @@ int filemap_write_and_wait(struct address_space *mapping)
365} 368}
366EXPORT_SYMBOL(filemap_write_and_wait); 369EXPORT_SYMBOL(filemap_write_and_wait);
367 370
371/*
372 * Write out and wait upon file offsets lstart->lend, inclusive.
373 *
374 * Note that `lend' is inclusive (describes the last byte to be written) so
375 * that this function can be used to write to the very end-of-file (end = -1).
376 */
368int filemap_write_and_wait_range(struct address_space *mapping, 377int filemap_write_and_wait_range(struct address_space *mapping,
369 loff_t lstart, loff_t lend) 378 loff_t lstart, loff_t lend)
370{ 379{
@@ -425,6 +434,28 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
425 return ret; 434 return ret;
426} 435}
427 436
437#ifdef CONFIG_NUMA
438struct page *page_cache_alloc(struct address_space *x)
439{
440 if (cpuset_do_page_mem_spread()) {
441 int n = cpuset_mem_spread_node();
442 return alloc_pages_node(n, mapping_gfp_mask(x), 0);
443 }
444 return alloc_pages(mapping_gfp_mask(x), 0);
445}
446EXPORT_SYMBOL(page_cache_alloc);
447
448struct page *page_cache_alloc_cold(struct address_space *x)
449{
450 if (cpuset_do_page_mem_spread()) {
451 int n = cpuset_mem_spread_node();
452 return alloc_pages_node(n, mapping_gfp_mask(x)|__GFP_COLD, 0);
453 }
454 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0);
455}
456EXPORT_SYMBOL(page_cache_alloc_cold);
457#endif
458
428/* 459/*
429 * In order to wait for pages to become available there must be 460 * In order to wait for pages to become available there must be
430 * waitqueues associated with pages. By using a hash table of 461 * waitqueues associated with pages. By using a hash table of