twl4030_charger: increase end-of-charge current
[pandora-kernel.git] / fs / nilfs2 / inode.c
index b50ffb7..3a70818 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/buffer_head.h>
 #include <linux/gfp.h>
 #include <linux/mpage.h>
+#include <linux/pagemap.h>
 #include <linux/writeback.h>
 #include <linux/uio.h>
 #include "nilfs.h"
@@ -195,11 +196,34 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc)
 
 static int nilfs_set_page_dirty(struct page *page)
 {
-       int ret = __set_page_dirty_buffers(page);
+       struct inode *inode = page->mapping->host;
+       int ret = __set_page_dirty_nobuffers(page);
+
+       if (page_has_buffers(page)) {
+               unsigned nr_dirty = 0;
+               struct buffer_head *bh, *head;
+
+               /*
+                * This page is locked by callers, and no other thread
+                * concurrently marks its buffers dirty since they are
+                * only dirtied through routines in fs/buffer.c in
+                * which call sites of mark_buffer_dirty are protected
+                * by page lock.
+                */
+               bh = head = page_buffers(page);
+               do {
+                       /* Do not mark hole blocks dirty */
+                       if (buffer_dirty(bh) || !buffer_mapped(bh))
+                               continue;
+
+                       set_buffer_dirty(bh);
+                       nr_dirty++;
+               } while (bh = bh->b_this_page, bh != head);
 
-       if (ret) {
-               struct inode *inode = page->mapping->host;
-               unsigned nr_dirty = 1 << (PAGE_SHIFT - inode->i_blkbits);
+               if (nr_dirty)
+                       nilfs_set_file_dirty(inode, nr_dirty);
+       } else if (ret) {
+               unsigned nr_dirty = 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits);
 
                nilfs_set_file_dirty(inode, nr_dirty);
        }
@@ -768,7 +792,7 @@ int nilfs_setattr(struct dentry *dentry, struct iattr *iattr)
        struct super_block *sb = inode->i_sb;
        int err;
 
-       err = inode_change_ok(inode, iattr);
+       err = setattr_prepare(dentry, iattr);
        if (err)
                return err;