]> err.no Git - linux-2.6/commitdiff
[PATCH] clean up __set_page_dirty_nobuffers()
authorAndrew Morton <akpm@osdl.org>
Sun, 10 Dec 2006 10:19:24 +0000 (02:19 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Sun, 10 Dec 2006 17:55:41 +0000 (09:55 -0800)
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>
fs/buffer.c
mm/page-writeback.c

index 517860f2d75b0d575e65af71f54745840a3a28ad..865570fe0d39dd2e5a5300041ee6f8bf32b8f6a9 100644 (file)
@@ -724,20 +724,19 @@ int __set_page_dirty_buffers(struct page *page)
        }
        spin_unlock(&mapping->private_lock);
 
-       if (!TestSetPageDirty(page)) {
-               write_lock_irq(&mapping->tree_lock);
-               if (page->mapping) {    /* Race with truncate? */
-                       if (mapping_cap_account_dirty(mapping))
-                               __inc_zone_page_state(page, NR_FILE_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;
+       if (TestSetPageDirty(page))
+               return 0;
+
+       write_lock_irq(&mapping->tree_lock);
+       if (page->mapping) {    /* Race with truncate? */
+               if (mapping_cap_account_dirty(mapping))
+                       __inc_zone_page_state(page, NR_FILE_DIRTY);
+               radix_tree_tag_set(&mapping->page_tree,
+                               page_index(page), PAGECACHE_TAG_DIRTY);
        }
-       return 0;
+       write_unlock_irq(&mapping->tree_lock);
+       __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
+       return 1;
 }
 EXPORT_SYMBOL(__set_page_dirty_buffers);
 
index 8d9b19f239c3ec03038e88cdd0a44e8a71c0d3e9..59ffcdbde8b38a411de80cd2d4420f4e0ad36c44 100644 (file)
@@ -761,23 +761,22 @@ int __set_page_dirty_nobuffers(struct page *page)
                struct address_space *mapping = page_mapping(page);
                struct address_space *mapping2;
 
-               if (mapping) {
-                       write_lock_irq(&mapping->tree_lock);
-                       mapping2 = page_mapping(page);
-                       if (mapping2) { /* Race with truncate? */
-                               BUG_ON(mapping2 != mapping);
-                               if (mapping_cap_account_dirty(mapping))
-                                       __inc_zone_page_state(page,
-                                                               NR_FILE_DIRTY);
-                               radix_tree_tag_set(&mapping->page_tree,
-                                       page_index(page), PAGECACHE_TAG_DIRTY);
-                       }
-                       write_unlock_irq(&mapping->tree_lock);
-                       if (mapping->host) {
-                               /* !PageAnon && !swapper_space */
-                               __mark_inode_dirty(mapping->host,
-                                                       I_DIRTY_PAGES);
-                       }
+               if (!mapping)
+                       return 1;
+
+               write_lock_irq(&mapping->tree_lock);
+               mapping2 = page_mapping(page);
+               if (mapping2) { /* Race with truncate? */
+                       BUG_ON(mapping2 != mapping);
+                       if (mapping_cap_account_dirty(mapping))
+                               __inc_zone_page_state(page, NR_FILE_DIRTY);
+                       radix_tree_tag_set(&mapping->page_tree,
+                               page_index(page), PAGECACHE_TAG_DIRTY);
+               }
+               write_unlock_irq(&mapping->tree_lock);
+               if (mapping->host) {
+                       /* !PageAnon && !swapper_space */
+                       __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
                }
                return 1;
        }
@@ -851,27 +850,26 @@ int test_clear_page_dirty(struct page *page)
        struct address_space *mapping = page_mapping(page);
        unsigned long flags;
 
-       if (mapping) {
-               write_lock_irqsave(&mapping->tree_lock, flags);
-               if (TestClearPageDirty(page)) {
-                       radix_tree_tag_clear(&mapping->page_tree,
-                                               page_index(page),
-                                               PAGECACHE_TAG_DIRTY);
-                       write_unlock_irqrestore(&mapping->tree_lock, flags);
-                       /*
-                        * 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;
-               }
+       if (!mapping)
+               return TestClearPageDirty(page);
+
+       write_lock_irqsave(&mapping->tree_lock, flags);
+       if (TestClearPageDirty(page)) {
+               radix_tree_tag_clear(&mapping->page_tree,
+                               page_index(page), PAGECACHE_TAG_DIRTY);
                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);
 
@@ -893,17 +891,17 @@ int clear_page_dirty_for_io(struct page *page)
 {
        struct address_space *mapping = page_mapping(page);
 
-       if (mapping) {
-               if (TestClearPageDirty(page)) {
-                       if (mapping_cap_account_dirty(mapping)) {
-                               page_mkclean(page);
-                               dec_zone_page_state(page, NR_FILE_DIRTY);
-                       }
-                       return 1;
+       if (!mapping)
+               return TestClearPageDirty(page);
+
+       if (TestClearPageDirty(page)) {
+               if (mapping_cap_account_dirty(mapping)) {
+                       page_mkclean(page);
+                       dec_zone_page_state(page, NR_FILE_DIRTY);
                }
-               return 0;
+               return 1;
        }
-       return TestClearPageDirty(page);
+       return 0;
 }
 EXPORT_SYMBOL(clear_page_dirty_for_io);