diff options
Diffstat (limited to 'fs/buffer.c')
| -rw-r--r-- | fs/buffer.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 373bb6292bdc..3b6d701073e7 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | * async buffer flushing, 1999 Andrea Arcangeli <andrea@suse.de> | 18 | * async buffer flushing, 1999 Andrea Arcangeli <andrea@suse.de> |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #include <linux/config.h> | ||
| 22 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
| 23 | #include <linux/syscalls.h> | 22 | #include <linux/syscalls.h> |
| 24 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
| @@ -471,13 +470,18 @@ out: | |||
| 471 | pass does the actual I/O. */ | 470 | pass does the actual I/O. */ |
| 472 | void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers) | 471 | void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers) |
| 473 | { | 472 | { |
| 473 | struct address_space *mapping = bdev->bd_inode->i_mapping; | ||
| 474 | |||
| 475 | if (mapping->nrpages == 0) | ||
| 476 | return; | ||
| 477 | |||
| 474 | invalidate_bh_lrus(); | 478 | invalidate_bh_lrus(); |
| 475 | /* | 479 | /* |
| 476 | * FIXME: what about destroy_dirty_buffers? | 480 | * FIXME: what about destroy_dirty_buffers? |
| 477 | * We really want to use invalidate_inode_pages2() for | 481 | * We really want to use invalidate_inode_pages2() for |
| 478 | * that, but not until that's cleaned up. | 482 | * that, but not until that's cleaned up. |
| 479 | */ | 483 | */ |
| 480 | invalidate_inode_pages(bdev->bd_inode->i_mapping); | 484 | invalidate_inode_pages(mapping); |
| 481 | } | 485 | } |
| 482 | 486 | ||
| 483 | /* | 487 | /* |
| @@ -564,7 +568,7 @@ still_busy: | |||
| 564 | * Completion handler for block_write_full_page() - pages which are unlocked | 568 | * Completion handler for block_write_full_page() - pages which are unlocked |
| 565 | * during I/O, and which have PageWriteback cleared upon I/O completion. | 569 | * during I/O, and which have PageWriteback cleared upon I/O completion. |
| 566 | */ | 570 | */ |
| 567 | void end_buffer_async_write(struct buffer_head *bh, int uptodate) | 571 | static void end_buffer_async_write(struct buffer_head *bh, int uptodate) |
| 568 | { | 572 | { |
| 569 | char b[BDEVNAME_SIZE]; | 573 | char b[BDEVNAME_SIZE]; |
| 570 | unsigned long flags; | 574 | unsigned long flags; |
| @@ -852,7 +856,7 @@ int __set_page_dirty_buffers(struct page *page) | |||
| 852 | write_lock_irq(&mapping->tree_lock); | 856 | write_lock_irq(&mapping->tree_lock); |
| 853 | if (page->mapping) { /* Race with truncate? */ | 857 | if (page->mapping) { /* Race with truncate? */ |
| 854 | if (mapping_cap_account_dirty(mapping)) | 858 | if (mapping_cap_account_dirty(mapping)) |
| 855 | inc_page_state(nr_dirty); | 859 | __inc_zone_page_state(page, NR_FILE_DIRTY); |
| 856 | radix_tree_tag_set(&mapping->page_tree, | 860 | radix_tree_tag_set(&mapping->page_tree, |
| 857 | page_index(page), | 861 | page_index(page), |
| 858 | PAGECACHE_TAG_DIRTY); | 862 | PAGECACHE_TAG_DIRTY); |
| @@ -2598,7 +2602,7 @@ int nobh_truncate_page(struct address_space *mapping, loff_t from) | |||
| 2598 | unsigned offset = from & (PAGE_CACHE_SIZE-1); | 2602 | unsigned offset = from & (PAGE_CACHE_SIZE-1); |
| 2599 | unsigned to; | 2603 | unsigned to; |
| 2600 | struct page *page; | 2604 | struct page *page; |
| 2601 | struct address_space_operations *a_ops = mapping->a_ops; | 2605 | const struct address_space_operations *a_ops = mapping->a_ops; |
| 2602 | char *kaddr; | 2606 | char *kaddr; |
| 2603 | int ret = 0; | 2607 | int ret = 0; |
| 2604 | 2608 | ||
| @@ -2983,6 +2987,7 @@ int try_to_free_buffers(struct page *page) | |||
| 2983 | 2987 | ||
| 2984 | spin_lock(&mapping->private_lock); | 2988 | spin_lock(&mapping->private_lock); |
| 2985 | ret = drop_buffers(page, &buffers_to_free); | 2989 | ret = drop_buffers(page, &buffers_to_free); |
| 2990 | spin_unlock(&mapping->private_lock); | ||
| 2986 | if (ret) { | 2991 | if (ret) { |
| 2987 | /* | 2992 | /* |
| 2988 | * If the filesystem writes its buffers by hand (eg ext3) | 2993 | * If the filesystem writes its buffers by hand (eg ext3) |
| @@ -2994,7 +2999,6 @@ int try_to_free_buffers(struct page *page) | |||
| 2994 | */ | 2999 | */ |
| 2995 | clear_page_dirty(page); | 3000 | clear_page_dirty(page); |
| 2996 | } | 3001 | } |
| 2997 | spin_unlock(&mapping->private_lock); | ||
| 2998 | out: | 3002 | out: |
| 2999 | if (buffers_to_free) { | 3003 | if (buffers_to_free) { |
| 3000 | struct buffer_head *bh = buffers_to_free; | 3004 | struct buffer_head *bh = buffers_to_free; |
| @@ -3166,7 +3170,6 @@ EXPORT_SYMBOL(block_sync_page); | |||
| 3166 | EXPORT_SYMBOL(block_truncate_page); | 3170 | EXPORT_SYMBOL(block_truncate_page); |
| 3167 | EXPORT_SYMBOL(block_write_full_page); | 3171 | EXPORT_SYMBOL(block_write_full_page); |
| 3168 | EXPORT_SYMBOL(cont_prepare_write); | 3172 | EXPORT_SYMBOL(cont_prepare_write); |
| 3169 | EXPORT_SYMBOL(end_buffer_async_write); | ||
| 3170 | EXPORT_SYMBOL(end_buffer_read_sync); | 3173 | EXPORT_SYMBOL(end_buffer_read_sync); |
| 3171 | EXPORT_SYMBOL(end_buffer_write_sync); | 3174 | EXPORT_SYMBOL(end_buffer_write_sync); |
| 3172 | EXPORT_SYMBOL(file_fsync); | 3175 | EXPORT_SYMBOL(file_fsync); |
