]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] set_page_dirty() return value fixes
authorAndrew Morton <akpm@osdl.org>
Fri, 24 Mar 2006 11:18:11 +0000 (03:18 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 24 Mar 2006 15:33:26 +0000 (07:33 -0800)
We need set_page_dirty() to return true if it actually transitioned the page
from a clean to dirty state.  This wasn't right in a couple of places.  Do a
kernel-wide audit, fix things up.

This leaves open the possibility of returning a negative errno from
set_page_dirty() sometime in the future.  But we don't do that at present.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/cris/arch-v32/drivers/cryptocop.c
drivers/block/rd.c
fs/buffer.c
include/linux/fs.h
mm/page-writeback.c

index 501fa52d8d3a1974285b1d8c1d0e9e73444f9f37..c59ee28a35f4cbd7aa665250ece1c6f4922ab7f2 100644 (file)
@@ -2944,7 +2944,7 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
                int spdl_err;
                /* Mark output pages dirty. */
                spdl_err = set_page_dirty_lock(outpages[i]);
-               DEBUG(if (spdl_err)printk("cryptocop_ioctl_process: set_page_dirty_lock returned %d\n", spdl_err));
+               DEBUG(if (spdl_err < 0)printk("cryptocop_ioctl_process: set_page_dirty_lock returned %d\n", spdl_err));
        }
        for (i = 0; i < nooutpages; i++){
                put_page(outpages[i]);
index 1c54f46d3f701bff756cfcd385a5eac38ac65a8c..940bfd7951e5c1c582a672447b65dd28ff1367c7 100644 (file)
@@ -186,7 +186,8 @@ static int ramdisk_writepages(struct address_space *mapping,
  */
 static int ramdisk_set_page_dirty(struct page *page)
 {
-       SetPageDirty(page);
+       if (!TestSetPageDirty(page))
+               return 1;
        return 0;
 }
 
index 11ca6eb46a336f6d013c5a999d92f740a4e95fd7..24262ea8cc5097d16744ef81ce5f46c72e0cfdaa 100644 (file)
@@ -865,8 +865,8 @@ int __set_page_dirty_buffers(struct page *page)
                }
                write_unlock_irq(&mapping->tree_lock);
                __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
+               return 1;
        }
-       
        return 0;
 }
 EXPORT_SYMBOL(__set_page_dirty_buffers);
index 0ad70c1e5e5573cc27e9dbd86bed77eca7aeecc9..092cfaee0cd285aa0dc9b9f90096dd05020db723 100644 (file)
@@ -350,7 +350,7 @@ struct address_space_operations {
        /* Write back some dirty pages from this mapping. */
        int (*writepages)(struct address_space *, struct writeback_control *);
 
-       /* Set a page dirty */
+       /* Set a page dirty.  Return true if this dirtied it */
        int (*set_page_dirty)(struct page *page);
 
        int (*readpages)(struct file *filp, struct address_space *mapping,
index c67ddc464721668f21d46477ec925eb30c437855..893d7677579ecfe3c7f420e77eeb81ae9aae7d49 100644 (file)
@@ -628,8 +628,6 @@ EXPORT_SYMBOL(write_one_page);
  */
 int __set_page_dirty_nobuffers(struct page *page)
 {
-       int ret = 0;
-
        if (!TestSetPageDirty(page)) {
                struct address_space *mapping = page_mapping(page);
                struct address_space *mapping2;
@@ -651,8 +649,9 @@ int __set_page_dirty_nobuffers(struct page *page)
                                                        I_DIRTY_PAGES);
                        }
                }
+               return 1;
        }
-       return ret;
+       return 0;
 }
 EXPORT_SYMBOL(__set_page_dirty_nobuffers);
 
@@ -682,8 +681,10 @@ int fastcall set_page_dirty(struct page *page)
                        return (*spd)(page);
                return __set_page_dirty_buffers(page);
        }
-       if (!PageDirty(page))
-               SetPageDirty(page);
+       if (!PageDirty(page)) {
+               if (!TestSetPageDirty(page))
+                       return 1;
+       }
        return 0;
 }
 EXPORT_SYMBOL(set_page_dirty);