aboutsummaryrefslogtreecommitdiffstats
path: root/fs/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 39ff14403d13..a073f3f4f013 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -360,16 +360,19 @@ void invalidate_bdev(struct block_device *bdev)
360 */ 360 */
361static void free_more_memory(void) 361static void free_more_memory(void)
362{ 362{
363 struct zone **zones; 363 struct zone *zone;
364 pg_data_t *pgdat; 364 int nid;
365 365
366 wakeup_pdflush(1024); 366 wakeup_pdflush(1024);
367 yield(); 367 yield();
368 368
369 for_each_online_pgdat(pgdat) { 369 for_each_online_node(nid) {
370 zones = pgdat->node_zonelists[gfp_zone(GFP_NOFS)].zones; 370 (void)first_zones_zonelist(node_zonelist(nid, GFP_NOFS),
371 if (*zones) 371 gfp_zone(GFP_NOFS), NULL,
372 try_to_free_pages(zones, 0, GFP_NOFS); 372 &zone);
373 if (zone)
374 try_to_free_pages(node_zonelist(nid, GFP_NOFS), 0,
375 GFP_NOFS);
373 } 376 }
374} 377}
375 378
@@ -1098,7 +1101,7 @@ grow_buffers(struct block_device *bdev, sector_t block, int size)
1098 1101
1099 printk(KERN_ERR "%s: requested out-of-range block %llu for " 1102 printk(KERN_ERR "%s: requested out-of-range block %llu for "
1100 "device %s\n", 1103 "device %s\n",
1101 __FUNCTION__, (unsigned long long)block, 1104 __func__, (unsigned long long)block,
1102 bdevname(bdev, b)); 1105 bdevname(bdev, b));
1103 return -EIO; 1106 return -EIO;
1104 } 1107 }
@@ -2208,8 +2211,8 @@ out:
2208 return err; 2211 return err;
2209} 2212}
2210 2213
2211int cont_expand_zero(struct file *file, struct address_space *mapping, 2214static int cont_expand_zero(struct file *file, struct address_space *mapping,
2212 loff_t pos, loff_t *bytes) 2215 loff_t pos, loff_t *bytes)
2213{ 2216{
2214 struct inode *inode = mapping->host; 2217 struct inode *inode = mapping->host;
2215 unsigned blocksize = 1 << inode->i_blkbits; 2218 unsigned blocksize = 1 << inode->i_blkbits;
@@ -2243,6 +2246,8 @@ int cont_expand_zero(struct file *file, struct address_space *mapping,
2243 goto out; 2246 goto out;
2244 BUG_ON(err != len); 2247 BUG_ON(err != len);
2245 err = 0; 2248 err = 0;
2249
2250 balance_dirty_pages_ratelimited(mapping);
2246 } 2251 }
2247 2252
2248 /* page covers the boundary, find the boundary offset */ 2253 /* page covers the boundary, find the boundary offset */
@@ -2323,23 +2328,6 @@ int block_commit_write(struct page *page, unsigned from, unsigned to)
2323 return 0; 2328 return 0;
2324} 2329}
2325 2330
2326int generic_commit_write(struct file *file, struct page *page,
2327 unsigned from, unsigned to)
2328{
2329 struct inode *inode = page->mapping->host;
2330 loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
2331 __block_commit_write(inode,page,from,to);
2332 /*
2333 * No need to use i_size_read() here, the i_size
2334 * cannot change under us because we hold i_mutex.
2335 */
2336 if (pos > inode->i_size) {
2337 i_size_write(inode, pos);
2338 mark_inode_dirty(inode);
2339 }
2340 return 0;
2341}
2342
2343/* 2331/*
2344 * block_page_mkwrite() is not allowed to change the file size as it gets 2332 * block_page_mkwrite() is not allowed to change the file size as it gets
2345 * called from a page fault handler when a page is first dirtied. Hence we must 2333 * called from a page fault handler when a page is first dirtied. Hence we must
@@ -3180,8 +3168,7 @@ static void recalc_bh_state(void)
3180 3168
3181struct buffer_head *alloc_buffer_head(gfp_t gfp_flags) 3169struct buffer_head *alloc_buffer_head(gfp_t gfp_flags)
3182{ 3170{
3183 struct buffer_head *ret = kmem_cache_alloc(bh_cachep, 3171 struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags);
3184 set_migrateflags(gfp_flags, __GFP_RECLAIMABLE));
3185 if (ret) { 3172 if (ret) {
3186 INIT_LIST_HEAD(&ret->b_assoc_buffers); 3173 INIT_LIST_HEAD(&ret->b_assoc_buffers);
3187 get_cpu_var(bh_accounting).nr++; 3174 get_cpu_var(bh_accounting).nr++;
@@ -3311,7 +3298,6 @@ EXPORT_SYMBOL(end_buffer_write_sync);
3311EXPORT_SYMBOL(file_fsync); 3298EXPORT_SYMBOL(file_fsync);
3312EXPORT_SYMBOL(fsync_bdev); 3299EXPORT_SYMBOL(fsync_bdev);
3313EXPORT_SYMBOL(generic_block_bmap); 3300EXPORT_SYMBOL(generic_block_bmap);
3314EXPORT_SYMBOL(generic_commit_write);
3315EXPORT_SYMBOL(generic_cont_expand_simple); 3301EXPORT_SYMBOL(generic_cont_expand_simple);
3316EXPORT_SYMBOL(init_buffer); 3302EXPORT_SYMBOL(init_buffer);
3317EXPORT_SYMBOL(invalidate_bdev); 3303EXPORT_SYMBOL(invalidate_bdev);