Commit 8c08540f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7c3ab738
...@@ -724,20 +724,19 @@ int __set_page_dirty_buffers(struct page *page) ...@@ -724,20 +724,19 @@ int __set_page_dirty_buffers(struct page *page)
} }
spin_unlock(&mapping->private_lock); spin_unlock(&mapping->private_lock);
if (!TestSetPageDirty(page)) { if (TestSetPageDirty(page))
write_lock_irq(&mapping->tree_lock); return 0;
if (page->mapping) { /* Race with truncate? */
if (mapping_cap_account_dirty(mapping)) write_lock_irq(&mapping->tree_lock);
__inc_zone_page_state(page, NR_FILE_DIRTY); if (page->mapping) { /* Race with truncate? */
radix_tree_tag_set(&mapping->page_tree, if (mapping_cap_account_dirty(mapping))
page_index(page), __inc_zone_page_state(page, NR_FILE_DIRTY);
PAGECACHE_TAG_DIRTY); radix_tree_tag_set(&mapping->page_tree,
} page_index(page), PAGECACHE_TAG_DIRTY);
write_unlock_irq(&mapping->tree_lock);
__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
return 1;
} }
return 0; write_unlock_irq(&mapping->tree_lock);
__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
return 1;
} }
EXPORT_SYMBOL(__set_page_dirty_buffers); EXPORT_SYMBOL(__set_page_dirty_buffers);
......
...@@ -761,23 +761,22 @@ int __set_page_dirty_nobuffers(struct page *page) ...@@ -761,23 +761,22 @@ int __set_page_dirty_nobuffers(struct page *page)
struct address_space *mapping = page_mapping(page); struct address_space *mapping = page_mapping(page);
struct address_space *mapping2; struct address_space *mapping2;
if (mapping) { if (!mapping)
write_lock_irq(&mapping->tree_lock); return 1;
mapping2 = page_mapping(page);
if (mapping2) { /* Race with truncate? */ write_lock_irq(&mapping->tree_lock);
BUG_ON(mapping2 != mapping); mapping2 = page_mapping(page);
if (mapping_cap_account_dirty(mapping)) if (mapping2) { /* Race with truncate? */
__inc_zone_page_state(page, BUG_ON(mapping2 != mapping);
NR_FILE_DIRTY); if (mapping_cap_account_dirty(mapping))
radix_tree_tag_set(&mapping->page_tree, __inc_zone_page_state(page, NR_FILE_DIRTY);
page_index(page), PAGECACHE_TAG_DIRTY); radix_tree_tag_set(&mapping->page_tree,
} page_index(page), PAGECACHE_TAG_DIRTY);
write_unlock_irq(&mapping->tree_lock); }
if (mapping->host) { write_unlock_irq(&mapping->tree_lock);
/* !PageAnon && !swapper_space */ if (mapping->host) {
__mark_inode_dirty(mapping->host, /* !PageAnon && !swapper_space */
I_DIRTY_PAGES); __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
}
} }
return 1; return 1;
} }
...@@ -851,27 +850,26 @@ int test_clear_page_dirty(struct page *page) ...@@ -851,27 +850,26 @@ int test_clear_page_dirty(struct page *page)
struct address_space *mapping = page_mapping(page); struct address_space *mapping = page_mapping(page);
unsigned long flags; unsigned long flags;
if (mapping) { if (!mapping)
write_lock_irqsave(&mapping->tree_lock, flags); return TestClearPageDirty(page);
if (TestClearPageDirty(page)) {
radix_tree_tag_clear(&mapping->page_tree, write_lock_irqsave(&mapping->tree_lock, flags);
page_index(page), if (TestClearPageDirty(page)) {
PAGECACHE_TAG_DIRTY); radix_tree_tag_clear(&mapping->page_tree,
write_unlock_irqrestore(&mapping->tree_lock, flags); page_index(page), PAGECACHE_TAG_DIRTY);
/*
* We can continue to use `mapping' here because the
* page is locked, which pins the address_space
*/
if (mapping_cap_account_dirty(mapping)) {
page_mkclean(page);
dec_zone_page_state(page, NR_FILE_DIRTY);
}
return 1;
}
write_unlock_irqrestore(&mapping->tree_lock, flags); write_unlock_irqrestore(&mapping->tree_lock, flags);
return 0; /*
* We can continue to use `mapping' here because the
* page is locked, which pins the address_space
*/
if (mapping_cap_account_dirty(mapping)) {
page_mkclean(page);
dec_zone_page_state(page, NR_FILE_DIRTY);
}
return 1;
} }
return TestClearPageDirty(page); write_unlock_irqrestore(&mapping->tree_lock, flags);
return 0;
} }
EXPORT_SYMBOL(test_clear_page_dirty); EXPORT_SYMBOL(test_clear_page_dirty);
...@@ -893,17 +891,17 @@ int clear_page_dirty_for_io(struct page *page) ...@@ -893,17 +891,17 @@ int clear_page_dirty_for_io(struct page *page)
{ {
struct address_space *mapping = page_mapping(page); struct address_space *mapping = page_mapping(page);
if (mapping) { if (!mapping)
if (TestClearPageDirty(page)) { return TestClearPageDirty(page);
if (mapping_cap_account_dirty(mapping)) {
page_mkclean(page); if (TestClearPageDirty(page)) {
dec_zone_page_state(page, NR_FILE_DIRTY); if (mapping_cap_account_dirty(mapping)) {
} page_mkclean(page);
return 1; dec_zone_page_state(page, NR_FILE_DIRTY);
} }
return 0; return 1;
} }
return TestClearPageDirty(page); return 0;
} }
EXPORT_SYMBOL(clear_page_dirty_for_io); EXPORT_SYMBOL(clear_page_dirty_for_io);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment