summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2006-03-24 03:18:11 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-24 07:33:26 -0800
commit4741c9fd36b3bcadd37238321c469049da94a4b9 (patch)
tree4b3031b04cdbf2d3c5a4fcc1965ed857f1cf0ce4
parentfa5a734e406b53761fcc5ee22366006f71112c2d (diff)
downloadop-kernel-dev-4741c9fd36b3bcadd37238321c469049da94a4b9.zip
op-kernel-dev-4741c9fd36b3bcadd37238321c469049da94a4b9.tar.gz
[PATCH] set_page_dirty() return value fixes
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>
-rw-r--r--arch/cris/arch-v32/drivers/cryptocop.c2
-rw-r--r--drivers/block/rd.c3
-rw-r--r--fs/buffer.c2
-rw-r--r--include/linux/fs.h2
-rw-r--r--mm/page-writeback.c11
5 files changed, 11 insertions, 9 deletions
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index 501fa52..c59ee28 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -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]);
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index 1c54f46..940bfd7 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -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;
}
diff --git a/fs/buffer.c b/fs/buffer.c
index 11ca6eb..24262ea 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 0ad70c1..092cfae 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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,
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index c67ddc4..893d767 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -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);
OpenPOWER on IntegriCloud