aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page-writeback.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2006-12-10 05:19:24 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-10 12:55:41 -0500
commit8c08540f8755c451d8b96ea14cfe796bc3cd712d (patch)
treeca2ba9673ce1c2733c538012105681b238265e48 /mm/page-writeback.c
parent7c3ab7381e79dfc7db14a67c6f4f3285664e1ec2 (diff)
[PATCH] clean up __set_page_dirty_nobuffers()
Save a tabstop in __set_page_dirty_nobuffers() and __set_page_dirty_buffers() and a few other places. No functional changes. Cc: Jay Lan <jlan@sgi.com> Cc: Shailabh Nagar <nagar@watson.ibm.com> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Chris Sturtivant <csturtiv@sgi.com> Cc: Tony Ernst <tee@sgi.com> Cc: Guillaume Thouvenin <guillaume.thouvenin@bull.net> Cc: David Wright <daw@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r--mm/page-writeback.c88
1 files changed, 43 insertions, 45 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 8d9b19f239c3..59ffcdbde8b3 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -761,23 +761,22 @@ int __set_page_dirty_nobuffers(struct page *page)
761 struct address_space *mapping = page_mapping(page); 761 struct address_space *mapping = page_mapping(page);
762 struct address_space *mapping2; 762 struct address_space *mapping2;
763 763
764 if (mapping) { 764 if (!mapping)
765 write_lock_irq(&mapping->tree_lock); 765 return 1;
766 mapping2 = page_mapping(page); 766
767 if (mapping2) { /* Race with truncate? */ 767 write_lock_irq(&mapping->tree_lock);
768 BUG_ON(mapping2 != mapping); 768 mapping2 = page_mapping(page);
769 if (mapping_cap_account_dirty(mapping)) 769 if (mapping2) { /* Race with truncate? */
770 __inc_zone_page_state(page, 770 BUG_ON(mapping2 != mapping);
771 NR_FILE_DIRTY); 771 if (mapping_cap_account_dirty(mapping))
772 radix_tree_tag_set(&mapping->page_tree, 772 __inc_zone_page_state(page, NR_FILE_DIRTY);
773 page_index(page), PAGECACHE_TAG_DIRTY); 773 radix_tree_tag_set(&mapping->page_tree,
774 } 774 page_index(page), PAGECACHE_TAG_DIRTY);
775 write_unlock_irq(&mapping->tree_lock); 775 }
776 if (mapping->host) { 776 write_unlock_irq(&mapping->tree_lock);
777 /* !PageAnon && !swapper_space */ 777 if (mapping->host) {
778 __mark_inode_dirty(mapping->host, 778 /* !PageAnon && !swapper_space */
779 I_DIRTY_PAGES); 779 __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
780 }
781 } 780 }
782 return 1; 781 return 1;
783 } 782 }
@@ -851,27 +850,26 @@ int test_clear_page_dirty(struct page *page)
851 struct address_space *mapping = page_mapping(page); 850 struct address_space *mapping = page_mapping(page);
852 unsigned long flags; 851 unsigned long flags;
853 852
854 if (mapping) { 853 if (!mapping)
855 write_lock_irqsave(&mapping->tree_lock, flags); 854 return TestClearPageDirty(page);
856 if (TestClearPageDirty(page)) { 855
857 radix_tree_tag_clear(&mapping->page_tree, 856 write_lock_irqsave(&mapping->tree_lock, flags);
858 page_index(page), 857 if (TestClearPageDirty(page)) {
859 PAGECACHE_TAG_DIRTY); 858 radix_tree_tag_clear(&mapping->page_tree,
860 write_unlock_irqrestore(&mapping->tree_lock, flags); 859 page_index(page), PAGECACHE_TAG_DIRTY);
861 /*
862 * We can continue to use `mapping' here because the
863 * page is locked, which pins the address_space
864 */
865 if (mapping_cap_account_dirty(mapping)) {
866 page_mkclean(page);
867 dec_zone_page_state(page, NR_FILE_DIRTY);
868 }
869 return 1;
870 }
871 write_unlock_irqrestore(&mapping->tree_lock, flags); 860 write_unlock_irqrestore(&mapping->tree_lock, flags);
872 return 0; 861 /*
862 * We can continue to use `mapping' here because the
863 * page is locked, which pins the address_space
864 */
865 if (mapping_cap_account_dirty(mapping)) {
866 page_mkclean(page);
867 dec_zone_page_state(page, NR_FILE_DIRTY);
868 }
869 return 1;
873 } 870 }
874 return TestClearPageDirty(page); 871 write_unlock_irqrestore(&mapping->tree_lock, flags);
872 return 0;
875} 873}
876EXPORT_SYMBOL(test_clear_page_dirty); 874EXPORT_SYMBOL(test_clear_page_dirty);
877 875
@@ -893,17 +891,17 @@ int clear_page_dirty_for_io(struct page *page)
893{ 891{
894 struct address_space *mapping = page_mapping(page); 892 struct address_space *mapping = page_mapping(page);
895 893
896 if (mapping) { 894 if (!mapping)
897 if (TestClearPageDirty(page)) { 895 return TestClearPageDirty(page);
898 if (mapping_cap_account_dirty(mapping)) { 896
899 page_mkclean(page); 897 if (TestClearPageDirty(page)) {
900 dec_zone_page_state(page, NR_FILE_DIRTY); 898 if (mapping_cap_account_dirty(mapping)) {
901 } 899 page_mkclean(page);
902 return 1; 900 dec_zone_page_state(page, NR_FILE_DIRTY);
903 } 901 }
904 return 0; 902 return 1;
905 } 903 }
906 return TestClearPageDirty(page); 904 return 0;
907} 905}
908EXPORT_SYMBOL(clear_page_dirty_for_io); 906EXPORT_SYMBOL(clear_page_dirty_for_io);
909 907